From cd11bc80579a629e8ab6f9ee9e1cd982f4396408 Mon Sep 17 00:00:00 2001
From: shiyunteng <shiyunteng@example.com>
Date: 星期三, 12 八月 2026 10:02:07 +0800
Subject: [PATCH] feat:银行流水绑定合同问题 出库单据查看 历史当前逾期新增删除去掉 完成开票隐藏开票按钮 出库业务单据文件类型
---
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/StatisticServiceImpl.java | 220 +++----
platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/entity/Contract.java | 4
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/BankStatementServiceImpl.java | 133 ++++
platformx-business-finance-biz/src/main/resources/mapper/ContractMapper.xml | 55 +
platformx-business-finance-biz/src/main/resources/mapper/ProductMapper.xml | 21
platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/AgingVo.java | 8
platformx-business-finance-biz/src/main/resources/mapper/BankStatementMapper.xml | 25
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/utils/SignHelper.java | 10
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/utils/NetworkFileToBase64.java | 68 ++
platformx-business-finance-biz/src/main/resources/mapper/DeliveryOverdueMapper.xml | 1
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/controller/PaymentSlipController.java | 18
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/ContractServiceImpl.java | 78 ++
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/PaymentConfirmServiceImpl.java | 365 ++----------
platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/dto/SyncPaymentRecepitDTO.java | 14
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/OutBoundServiceImpl.java | 1
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/PaymentOffsetServiceImpl.java | 6
platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/dto/ContractAddDTO.java | 3
platformx-business-finance-biz/src/main/resources/mapper/ContractPaymentScheduleMapper.xml | 197 ++++--
platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/ContractDetailVo.java | 3
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/ContractInvoiceServiceImpl.java | 79 +-
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/controller/BankStatementController.java | 123 ++++
platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/entity/BankStatement.java | 74 ++
platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/dto/BankStatementUpdateDTO.java | 12
platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/DeliveryOverduePageVo.java | 3
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/mapper/BankStatementMapper.java | 11
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/BankStatementService.java | 11
platformx-business-finance-biz/src/main/resources/mapper/ContractOutBoundMapper.xml | 99 ++-
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/PaymentConfirmService.java | 3
28 files changed, 1,044 insertions(+), 601 deletions(-)
diff --git a/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/dto/BankStatementUpdateDTO.java b/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/dto/BankStatementUpdateDTO.java
new file mode 100644
index 0000000..711ac8d
--- /dev/null
+++ b/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/dto/BankStatementUpdateDTO.java
@@ -0,0 +1,12 @@
+package com.by4cloud.platformx.business.dto;
+
+import lombok.Data;
+
+@Data
+public class BankStatementUpdateDTO {
+
+ private Long id;
+
+ private Long contractId;
+
+}
diff --git a/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/dto/ContractAddDTO.java b/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/dto/ContractAddDTO.java
index 28bae44..0870e9f 100644
--- a/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/dto/ContractAddDTO.java
+++ b/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/dto/ContractAddDTO.java
@@ -79,6 +79,9 @@
@Schema(description = "鍚堝悓闄勪欢URL")
private String attachmentUrl;
+ @Schema(description = "鍚堝悓闄勪欢鍚嶇О")
+ private String attachmentName;
+
@Schema(description = "澶囨敞")
private String remark;
diff --git a/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/dto/SyncPaymentRecepitDTO.java b/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/dto/SyncPaymentRecepitDTO.java
new file mode 100644
index 0000000..af12f6d
--- /dev/null
+++ b/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/dto/SyncPaymentRecepitDTO.java
@@ -0,0 +1,14 @@
+package com.by4cloud.platformx.business.dto;
+
+import lombok.Data;
+
+@Data
+public class SyncPaymentRecepitDTO {
+
+ private String startDate;
+
+ private String endDate;
+
+ private String bipCode;
+
+}
diff --git a/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/entity/BankStatement.java b/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/entity/BankStatement.java
new file mode 100644
index 0000000..f720190
--- /dev/null
+++ b/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/entity/BankStatement.java
@@ -0,0 +1,74 @@
+package com.by4cloud.platformx.business.entity;
+
+import com.by4cloud.platformx.common.data.mybatis.BaseModel;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.v3.oas.annotations.media.Schema;
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import lombok.Data;
+import org.hibernate.annotations.Table;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 2026骞�8鏈�7鏃� 16:04:22
+ * syt
+ */
+@Data
+@Entity//鍔犱簡鎵嶈兘鑷姩鐢熸垚琛�
+@Table(appliesTo="bank_statement",comment = "閾惰娴佹按")//缁欒〃鍔犳敞閲�
+@jakarta.persistence.Table(name = "bank_statement")//鏁版嵁搴撳垱寤虹殑琛ㄦ槑
+public class BankStatement extends BaseModel<BankStatement> {
+
+ @Schema(description = "浜ゆ槗娴佹按")
+ @Column(columnDefinition="VARCHAR(128) comment '浜ゆ槗娴佹按'")
+ private String bankSeqNo;
+
+ @Schema(description = "鏀舵閾惰璐︽埛id")
+ @Column(columnDefinition="VARCHAR(128) comment '鏀舵閾惰璐︽埛id'")
+ private String receiveBankAcc;
+
+ @Schema(description = "鏀舵閾惰璐︽埛璐﹀彿")
+ @Column(columnDefinition="VARCHAR(128) comment '鏀舵閾惰璐︽埛璐﹀彿'")
+ private String receiveBankAccAcc;
+
+ @Schema(description = "鏀舵閾惰璐︽埛鎴峰悕")
+ @Column(columnDefinition="VARCHAR(128) comment '鏀舵閾惰璐︽埛鎴峰悕'")
+ private String receiveBankAccName;
+
+ @Schema(description = "浠樻閾惰璐︽埛")
+ @Column(columnDefinition="VARCHAR(128) comment '浠樻閾惰璐︽埛'")
+ private String payBankNo;
+
+ @Schema(description = "浠樻閾惰璐︽埛鎴峰悕")
+ @Column(columnDefinition="VARCHAR(128) comment '浠樻閾惰璐︽埛鎴峰悕'")
+ private String payBankAccName;
+
+ @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ @Schema(description = "浜ゆ槗鏃堕棿")
+ @Column(columnDefinition = "datetime comment '浜ゆ槗鏃堕棿'")
+ private Date tranDate;
+
+ @Schema(description = "浜ゆ槗閲戦")
+ @Column(columnDefinition = "decimal(10,2) comment '浜ゆ槗閲戦'")
+ private BigDecimal tranAmount;
+
+ @Schema(description = "鏁版嵁ID")
+ @Column(columnDefinition="bigint comment '鏁版嵁ID'")
+ private Long dataId;
+
+ @Schema(description = "鏁版嵁")
+ @Column(columnDefinition="text comment '鏁版嵁'")
+ private String dataJson;
+
+ @Schema(description = "瀹㈡埛ID")
+ @Column(columnDefinition="bigint comment '瀹㈡埛ID'")
+ private Long busGuestId;
+
+ @Schema(description = "鍚堝悓ID")
+ @Column(columnDefinition="bigint comment '鍚堝悓ID'")
+ private Long contractId;
+}
diff --git a/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/entity/Contract.java b/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/entity/Contract.java
index 642f2a7..d6c349c 100644
--- a/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/entity/Contract.java
+++ b/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/entity/Contract.java
@@ -395,4 +395,8 @@
@Column(columnDefinition = "decimal(10,2) comment '鍑哄簱閲戦'")
private BigDecimal outBoundAmout;
+ @Schema(description = "鍚堝悓涓績鎺ㄩ�佹爣璇�")
+ @Column(columnDefinition = "char DEFAULT '0' comment '鍚堝悓涓績鎺ㄩ�佹爣璇� 0 鏈帹 1 宸叉帹'")
+ private String centerPushFlag;
+
}
diff --git a/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/AgingVo.java b/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/AgingVo.java
index 1b85a43..b07161d 100644
--- a/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/AgingVo.java
+++ b/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/AgingVo.java
@@ -7,19 +7,23 @@
@Data
public class AgingVo {
+ private Long sort;
+
private String overdueRange;
private BigDecimal totalAmount;
private BigDecimal totalPercent;
- public AgingVo(String overdueRange,BigDecimal totalAmount, BigDecimal totalPercent) {
+ public AgingVo(Long sort,String overdueRange,BigDecimal totalAmount, BigDecimal totalPercent) {
+ this.sort = sort;
this.overdueRange = overdueRange;
this.totalAmount = totalAmount;
this.totalPercent = totalPercent;
}
- public AgingVo(String overdueRange, BigDecimal totalAmount) {
+ public AgingVo(Long sort,String overdueRange, BigDecimal totalAmount) {
+ this.sort = sort;
this.overdueRange = overdueRange;
this.totalAmount = totalAmount;
}
diff --git a/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/ContractDetailVo.java b/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/ContractDetailVo.java
index d79a933..1492a17 100644
--- a/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/ContractDetailVo.java
+++ b/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/ContractDetailVo.java
@@ -77,6 +77,9 @@
@Schema(description = "鍚堝悓闄勪欢URL")
private String attachmentUrl;
+ @Schema(description = "鍚堝悓闄勪欢鍚嶇О")
+ private String attachmentName;
+
@Schema(description = "澶囨敞")
private String remark;
diff --git a/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/DeliveryOverduePageVo.java b/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/DeliveryOverduePageVo.java
index 126b5a0..db30365 100644
--- a/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/DeliveryOverduePageVo.java
+++ b/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/DeliveryOverduePageVo.java
@@ -17,6 +17,9 @@
@Schema(description = "瀹㈠晢ID")
private Long busGuestId;
+ @Schema(description = "鍚堝悓缂栧彿")
+ private String contractNo;
+
@Schema(description = "鍚堝悓鍚嶇О")
private String contractName;
diff --git a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/controller/BankStatementController.java b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/controller/BankStatementController.java
new file mode 100644
index 0000000..ac7e2f1
--- /dev/null
+++ b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/controller/BankStatementController.java
@@ -0,0 +1,123 @@
+package com.by4cloud.platformx.business.controller;
+
+import cn.hutool.core.util.StrUtil;
+import cn.hutool.core.util.ArrayUtil;
+import cn.hutool.core.collection.CollUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.by4cloud.platformx.business.dto.BankStatementUpdateDTO;
+import com.by4cloud.platformx.business.entity.BankStatement;
+import com.by4cloud.platformx.common.core.util.R;
+import com.by4cloud.platformx.common.log.annotation.SysLog;
+import com.by4cloud.platformx.business.service.BankStatementService;
+import org.springframework.security.access.prepost.PreAuthorize;
+import com.by4cloud.platformx.common.excel.annotation.ResponseExcel;
+import io.swagger.v3.oas.annotations.security.SecurityRequirement;
+import org.springdoc.core.annotations.ParameterObject;
+import org.springframework.http.HttpHeaders;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import io.swagger.v3.oas.annotations.Operation;
+import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+import java.util.Objects;
+
+/**
+ * 閾惰娴佹按
+ *
+ * @author syt
+ * @date 2026-08-07 16:10:36
+ */
+@RestController
+@RequiredArgsConstructor
+@RequestMapping("/bankStatement" )
+@Tag(description = "bankStatement" , name = "閾惰娴佹按绠$悊" )
+@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
+public class BankStatementController {
+
+ private final BankStatementService bankStatementService;
+
+ /**
+ * 鍒嗛〉鏌ヨ
+ * @param page 鍒嗛〉瀵硅薄
+ * @param bankStatement 閾惰娴佹按
+ * @return
+ */
+ @Operation(summary = "鍒嗛〉鏌ヨ" , description = "鍒嗛〉鏌ヨ" )
+ @GetMapping("/page" )
+ @PreAuthorize("@pms.hasPermission('business_bankStatement_view')" )
+ public R getBankStatementPage(@ParameterObject Page page, @ParameterObject BankStatement bankStatement) {
+ LambdaQueryWrapper<BankStatement> wrapper = Wrappers.lambdaQuery();
+ wrapper.like(StrUtil.isNotBlank(bankStatement.getPayBankAccName()),BankStatement::getPayBankAccName,bankStatement.getPayBankAccName());
+ wrapper.like(StrUtil.isNotBlank(bankStatement.getReceiveBankAccName()),BankStatement::getReceiveBankAccName,bankStatement.getReceiveBankAccName());
+ wrapper.orderByDesc(BankStatement::getCreateTime);
+ return R.ok(bankStatementService.pageByScope(page, wrapper));
+ }
+
+
+ /**
+ * 閫氳繃id鏌ヨ閾惰娴佹按
+ * @param id id
+ * @return R
+ */
+ @Operation(summary = "閫氳繃id鏌ヨ" , description = "閫氳繃id鏌ヨ" )
+ @GetMapping("/{id}" )
+ @PreAuthorize("@pms.hasPermission('business_bankStatement_view')" )
+ public R getById(@PathVariable("id" ) Long id) {
+ return R.ok(bankStatementService.getById(id));
+ }
+
+ /**
+ * 鏂板閾惰娴佹按
+ * @param bankStatement 閾惰娴佹按
+ * @return R
+ */
+ @Operation(summary = "鏂板閾惰娴佹按" , description = "鏂板閾惰娴佹按" )
+ @SysLog("鏂板閾惰娴佹按" )
+ @PostMapping
+ @PreAuthorize("@pms.hasPermission('business_bankStatement_add')" )
+ public R save(@RequestBody BankStatement bankStatement) {
+ return R.ok(bankStatementService.save(bankStatement));
+ }
+
+ /**
+ * 淇敼閾惰娴佹按
+ * @param updateDTO 閾惰娴佹按
+ * @return R
+ */
+ @Operation(summary = "淇敼閾惰娴佹按" , description = "淇敼閾惰娴佹按" )
+ @SysLog("淇敼閾惰娴佹按" )
+ @PostMapping("/edit")
+ public R updateById(@RequestBody BankStatementUpdateDTO updateDTO) {
+ return bankStatementService.edit(updateDTO);
+ }
+
+ /**
+ * 閫氳繃id鍒犻櫎閾惰娴佹按
+ * @param ids id鍒楄〃
+ * @return R
+ */
+ @Operation(summary = "閫氳繃id鍒犻櫎閾惰娴佹按" , description = "閫氳繃id鍒犻櫎閾惰娴佹按" )
+ @SysLog("閫氳繃id鍒犻櫎閾惰娴佹按" )
+ @DeleteMapping
+ @PreAuthorize("@pms.hasPermission('business_bankStatement_del')" )
+ public R removeById(@RequestBody Long[] ids) {
+ return R.ok(bankStatementService.removeBatchByIds(CollUtil.toList(ids)));
+ }
+
+
+ /**
+ * 瀵煎嚭excel 琛ㄦ牸
+ * @param bankStatement 鏌ヨ鏉′欢
+ * @param ids 瀵煎嚭鎸囧畾ID
+ * @return excel 鏂囦欢娴�
+ */
+ @ResponseExcel
+ @GetMapping("/export")
+ @PreAuthorize("@pms.hasPermission('business_bankStatement_export')" )
+ public List<BankStatement> export(BankStatement bankStatement,Long[] ids) {
+ return bankStatementService.list(Wrappers.lambdaQuery(bankStatement).in(ArrayUtil.isNotEmpty(ids), BankStatement::getId, ids));
+ }
+}
\ No newline at end of file
diff --git a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/controller/PaymentSlipController.java b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/controller/PaymentSlipController.java
index 21aa500..89f2fb5 100644
--- a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/controller/PaymentSlipController.java
+++ b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/controller/PaymentSlipController.java
@@ -7,11 +7,13 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.by4cloud.platformx.business.dto.PaymentConfirmQueryDTO;
import com.by4cloud.platformx.business.dto.PaymentSlipQueryDTO;
+import com.by4cloud.platformx.business.dto.SyncPaymentRecepitDTO;
import com.by4cloud.platformx.business.entity.PaymentConfirm;
import com.by4cloud.platformx.business.entity.PaymentSlip;
import com.by4cloud.platformx.business.service.PaymentConfirmService;
import com.by4cloud.platformx.business.service.PaymentSlipService;
import com.by4cloud.platformx.common.core.util.R;
+import com.by4cloud.platformx.common.security.annotation.Inner;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
@@ -31,7 +33,7 @@
*/
@RestController
@RequiredArgsConstructor
-@RequestMapping("/paymentSlip" )
+ @RequestMapping("/paymentSlip" )
@Tag(description = "paymentSlip" , name = "鏀舵鍗�" )
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
public class PaymentSlipController {
@@ -53,8 +55,18 @@
/**
* 瀹氭椂鏌ヨ鏀舵鍗�
*/
+ @Inner(value = false)
@GetMapping("syncPaymentRecepit")
- public R syncPaymentRecepit(){
- return paymentConfirmService.syncPaymentRecepit();
+ public R syncPaymentRecepit(SyncPaymentRecepitDTO dto){
+ return paymentConfirmService.syncPaymentRecepit(dto);
+ }
+
+ /**
+ * 瀹氭椂鏌ヨ鏀舵鍗�
+ */
+ @Inner(value = false)
+ @GetMapping("syncPaymentRecepitHandle")
+ public R syncPaymentRecepitHandle(@ParameterObject SyncPaymentRecepitDTO dto){
+ return paymentConfirmService.syncPaymentRecepit(dto);
}
}
diff --git a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/mapper/BankStatementMapper.java b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/mapper/BankStatementMapper.java
new file mode 100644
index 0000000..5e13939
--- /dev/null
+++ b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/mapper/BankStatementMapper.java
@@ -0,0 +1,11 @@
+package com.by4cloud.platformx.business.mapper;
+
+import com.by4cloud.platformx.common.data.datascope.PlatformxBaseMapper;
+import com.by4cloud.platformx.business.entity.BankStatement;
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+public interface BankStatementMapper extends PlatformxBaseMapper<BankStatement> {
+
+
+}
\ No newline at end of file
diff --git a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/BankStatementService.java b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/BankStatementService.java
new file mode 100644
index 0000000..72f5663
--- /dev/null
+++ b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/BankStatementService.java
@@ -0,0 +1,11 @@
+package com.by4cloud.platformx.business.service;
+
+import com.by4cloud.platformx.business.dto.BankStatementUpdateDTO;
+import com.by4cloud.platformx.business.entity.BankStatement;
+import com.by4cloud.platformx.common.core.util.R;
+import com.by4cloud.platformx.common.data.mybatis.IIService;
+
+public interface BankStatementService extends IIService<BankStatement> {
+
+ R edit(BankStatementUpdateDTO updateDTO);
+}
\ No newline at end of file
diff --git a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/PaymentConfirmService.java b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/PaymentConfirmService.java
index 247e316..e719419 100644
--- a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/PaymentConfirmService.java
+++ b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/PaymentConfirmService.java
@@ -2,6 +2,7 @@
import com.alibaba.fastjson.JSONObject;
import com.by4cloud.platformx.business.dto.PaymentConfirmAddDTO;
+import com.by4cloud.platformx.business.dto.SyncPaymentRecepitDTO;
import com.by4cloud.platformx.business.entity.PaymentConfirm;
import com.by4cloud.platformx.common.core.util.R;
import com.by4cloud.platformx.common.data.mybatis.IIService;
@@ -10,7 +11,7 @@
R add(PaymentConfirmAddDTO addDTO);
- R syncPaymentRecepit();
+ R syncPaymentRecepit(SyncPaymentRecepitDTO dto);
String getAccessToken(String accessToken);
diff --git a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/BankStatementServiceImpl.java b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/BankStatementServiceImpl.java
new file mode 100644
index 0000000..15acf79
--- /dev/null
+++ b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/BankStatementServiceImpl.java
@@ -0,0 +1,133 @@
+package com.by4cloud.platformx.business.service.impl;
+
+import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.util.ObjUtil;
+import cn.hutool.core.util.StrUtil;
+import cn.hutool.http.HttpUtil;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.by4cloud.platformx.business.dto.BankStatementUpdateDTO;
+import com.by4cloud.platformx.business.dto.PaymentConfirmAddDTO;
+import com.by4cloud.platformx.business.entity.BankStatement;
+import com.by4cloud.platformx.business.entity.BusinessCustomer;
+import com.by4cloud.platformx.business.entity.Contract;
+import com.by4cloud.platformx.business.mapper.BankStatementMapper;
+import com.by4cloud.platformx.business.mapper.BusinessCustomerMapper;
+import com.by4cloud.platformx.business.mapper.ContractMapper;
+import com.by4cloud.platformx.business.service.BankStatementService;
+import com.by4cloud.platformx.business.service.PaymentConfirmService;
+import com.by4cloud.platformx.common.core.util.R;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.data.redis.core.StringRedisTemplate;
+import org.springframework.stereotype.Service;
+/**
+ * 閾惰娴佹按
+ *
+ * @author syt
+ * @date 2026-08-07 16:10:36
+ */
+@Slf4j
+@Service
+@RequiredArgsConstructor
+public class BankStatementServiceImpl extends ServiceImpl<BankStatementMapper, BankStatement> implements BankStatementService {
+
+ private final PaymentConfirmService paymentConfirmService;
+ private final ContractMapper contractMapper;
+ private final BusinessCustomerMapper businessCustomerMapper;
+ private final StringRedisTemplate redisTemplate;
+
+ @Value("${bip.url}")
+ private String url;
+
+ @Override
+ public R edit(BankStatementUpdateDTO updateDTO) {
+ BankStatement statement = baseMapper.selectById(updateDTO.getId());
+ Contract contract = contractMapper.selectById(updateDTO.getContractId());
+ if (ObjUtil.isNull(contract)){
+ return R.failed("鍚堝悓鏌ヨ澶辫触");
+ }
+ PaymentConfirmAddDTO addDTO = new PaymentConfirmAddDTO();
+ addDTO.setBusGuestId(statement.getBusGuestId()+"");
+ addDTO.setConfirmTime(statement.getTranDate());
+ addDTO.setContractNo(contract.getContractNo());
+ addDTO.setInOrOut("1");
+ addDTO.setTransationAmount(statement.getTranAmount());
+ R r = paymentConfirmService.add(addDTO);
+ if (!r.isOk()){
+ return r;
+ }
+ statement.setContractId(updateDTO.getContractId());
+ baseMapper.updateById(statement);
+
+ //bip鎺ㄩ��
+ pushSaveCollection(statement);
+ return R.ok();
+ }
+
+ private void pushSaveCollection(BankStatement statement) {
+ String accessToken = "";
+ if (redisTemplate.hasKey("BIP_TOKEN")) {
+ accessToken = (String) redisTemplate.opsForValue().get("BIP_TOKEN");
+ } else {
+ paymentConfirmService.getAccessToken(accessToken);
+ }
+ if (StrUtil.isEmpty(accessToken)) {
+ log.error("bip accessToken 鑾峰彇寮傚父");
+ return;
+ }
+ String finalAccessToken = accessToken;
+ JSONObject params = genRequestParam(statement);
+
+ log.info("鏀舵鍗曢泦鎴� Request:{}", params.toJSONString());
+ String result = HttpUtil.post(url + "/yonbip/EFI/receivable/save?access_token=" + finalAccessToken, params.toJSONString());
+ log.info("鏀舵鍗曢泦鎴� Response:{}", result);
+
+ }
+
+ private JSONObject genRequestParam(BankStatement statement) {
+ BusinessCustomer customer = businessCustomerMapper.selectById(statement.getBusGuestId());
+ Contract contract = contractMapper.selectById(statement.getContractId());
+ JSONObject req = new JSONObject();
+
+ JSONObject data = new JSONObject();
+
+
+ JSONObject freeCh = new JSONObject();
+ freeCh.put("YSYF57","MJHYXGLXT");
+
+ data.put("freeChId",freeCh);
+ data.put("extVouchCode",statement.getBankSeqNo());
+ data.put("billDate",statement.getTranDate());
+ data.put("objectType","1");
+ data.put("customerCode",customer.getCreditCode());
+ data.put("exchangeRate",1);
+ data.put("exchangeRateDate", DateUtil.now());
+ data.put("contractNo",contract.getContractNo());
+
+ JSONArray bodyItems = new JSONArray();
+
+ JSONObject bodyItem = new JSONObject();
+ bodyItem.put("srcBillType","38");
+ bodyItem.put("srcBillNo",statement.getBankSeqNo());
+
+ JSONObject freeChItem = new JSONObject();
+ freeChItem.put("YSZJX01A","涓氬姟璧勯噾棰勭畻椤圭洰");
+ freeChItem.put("YSZJX05","");
+ freeChItem.put("YSZJX11","2146820445301112836");
+ freeChItem.put("zzbkfl","");
+ bodyItem.put("freeChId",freeChItem);
+
+ bodyItems.add(bodyItem);
+ data.put("bodyItem",bodyItems);
+
+ data.put("_status","Insert");
+ data.put("oriTaxIncludedAmount",statement.getTranAmount());
+
+ req.put("data",data);
+ return req;
+
+ }
+}
\ No newline at end of file
diff --git a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/ContractInvoiceServiceImpl.java b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/ContractInvoiceServiceImpl.java
index 9d07ded..d2bb434 100644
--- a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/ContractInvoiceServiceImpl.java
+++ b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/ContractInvoiceServiceImpl.java
@@ -141,7 +141,7 @@
private GenInvoiceInfoVo genInvoiceInfoVo(GenInvoiceInfoDTO genInvoiceInfoDTO, Contract contract, SysDept b) {
GenInvoiceInfoVo vo = new GenInvoiceInfoVo();
BusinessCustomer a = businessCustomerMapper.selectById(contract.getPartyAId());
- vo.setPartyA(a.getRegisterName());
+ vo.setPartyA(a.getCompanyName());
vo.setPartyAOrgCode(a.getCreditCode());
vo.setPartyAOpenBank(a.getBankName());
vo.setPartyABankAccount(a.getBankAccount());
@@ -322,10 +322,12 @@
if (!StrUtil.equals(contract.getContractCategory(),"water_house")) {
//鏇存柊鍚堝悓鍑哄簱鍗曠姸鎬�
genInvoiceInfoDTO.getOutBoundInvoiceList().stream().forEach(contractOutBoundInvoiceVo -> {
- ContractOutBound bound = contractOutBoundMapper.selectById(contractOutBoundInvoiceVo.getContractOutBoundId());
- bound.setInvoiceStatus("1");
- bound.setInvoiceNum(bound.getInvoiceNum().add(contractOutBoundInvoiceVo.getInvoiceNum()));
- contractOutBoundMapper.updateById(bound);
+ ContractOutBound contractOutBound = contractOutBoundMapper.selectById(contractOutBoundInvoiceVo.getContractOutBoundId());
+ contractOutBound.setInvoiceStatus("1");
+ if (contractOutBoundInvoiceVo.getInvoiceNum().compareTo(contractOutBound.getOutBoundNum().subtract(contractOutBound.getInvoiceNum()))<=0) {
+ contractOutBound.setInvoiceNum(contractOutBound.getInvoiceNum().subtract(contractOutBoundInvoiceVo.getInvoiceNum()));
+ }
+ contractOutBoundMapper.updateById(contractOutBound);
});
}else {
//鏇存柊鍚堝悓鎴跨 姘寸數 璐瑰紑绁ㄧ姸鎬�
@@ -616,16 +618,22 @@
data.put("billDate",DateUtil.format(contractInvoice.getInvoiceTime(),DatePattern.NORM_DATETIME_FORMAT));
data.put("objectType","1");
data.put("exchangeRate","1");
- data.put("exchangeRate",DateUtil.now());
+ data.put("exchangeRateDate",DateUtil.now());
data.put("_status","Insert");
GenInvoiceInfoVo vo = BeanUtil.copyProperties(JSONObject.parseObject(contractInvoice.getInvoicePreview()), GenInvoiceInfoVo.class);
JSONArray bodyItem = new JSONArray();
for (InvoiceItemVo invoiceItemVo : vo.getInvoiceItemList()) {
JSONObject item = new JSONObject();
+
+ JSONObject freeCh = new JSONObject();
+ freeCh.put("JT32","");
+ item.put("freeChId",freeCh);
+
item.put("invoiceNo",contractInvoice.getInvoiceNo());
item.put("materialCode",invoiceItemVo.getErpCode());
item.put("taxRate", invoiceItemVo.getTaxRate());
item.put("oriTaxAmount", invoiceItemVo.getPriceTax());
+ item.put("oriTaxExcludedAmount", invoiceItemVo.getPriceNoTax());
item.put("oriTaxIncludedAmount", invoiceItemVo.getUnitPrice().multiply(invoiceItemVo.getQuantity()));
item.put("_status","Insert");
@@ -701,33 +709,18 @@
if (!StrUtil.equals(contract.getContractCategory(),"water_house")) {
//鍚堝悓鐘舵��
if (StrUtil.equals(contract.getBillingStatus(), "2")) {
- if (ObjUtil.isNull(contract.getBillingAmout())) {
- contract.setBillingAmout(vo.getTotalPrice());
- if (contract.getBillingAmout().compareTo(contract.getAmount()) == 0) {
- contract.setBillingStatus("3");
- }
- if (contract.getBillingAmout().compareTo(contract.getAmount()) < 0) {
- contract.setBillingStatus("1");
- }
- contractMapper.updateById(contract);
- } else {
- contract.setBillingAmout(vo.getTotalPrice().add(contract.getBillingAmout()));
- if (contract.getBillingAmout().compareTo(contract.getAmount()) == 0) {
- contract.setBillingStatus("3");
- }
- if (contract.getBillingAmout().compareTo(contract.getAmount()) < 0) {
- contract.setBillingStatus("1");
- }
- contractMapper.updateById(contract);
+ contract.setBillingAmout(vo.getTotalPrice().add(contract.getBillingAmout()));
+ if (contract.getBillingAmout().compareTo(contract.getAmount()) == 0) {
+ contract.setBillingStatus("3");
}
- } else {
- if (ObjUtil.isNull(contract.getBillingAmout())) {
- contract.setBillingAmout(vo.getTotalPrice());
- contractMapper.updateById(contract);
- } else {
- contract.setBillingAmout(vo.getTotalPrice().add(contract.getBillingAmout()));
- contractMapper.updateById(contract);
+ if (contract.getBillingAmout().compareTo(contract.getAmount()) < 0) {
+ contract.setBillingStatus("1");
}
+ //闃叉閲嶅瀹″紑绁ㄥ鏍搁�氳繃鍚� 寮�绁ㄩ噾棰濊秴鍑哄悎鍚岄噾棰�
+ if (contract.getBillingAmout().compareTo(contract.getAmount())>0){
+ contract.setBillingAmout(contract.getAmount());
+ }
+ contractMapper.updateById(contract);
}
}else {
//鍒ゆ柇 寰幆鏄惁瀹屾垚
@@ -756,10 +749,10 @@
contract.setBillingStatus("2");
}
}
- if (ObjUtil.isNull(contract.getBillingAmout())) {
- contract.setBillingAmout(vo.getTotalPrice());
- } else {
- contract.setBillingAmout(vo.getTotalPrice().add(contract.getBillingAmout()));
+ contract.setBillingAmout(vo.getTotalPrice().add(contract.getBillingAmout()));
+ //闃叉閲嶅瀹″紑绁ㄥ鏍搁�氳繃鍚� 寮�绁ㄩ噾棰濊秴鍑哄悎鍚岄噾棰�
+ if (contract.getBillingAmout().compareTo(contract.getAmount())>0){
+ contract.setBillingAmout(contract.getAmount());
}
contractMapper.updateById(contract);
}
@@ -796,6 +789,10 @@
}
}
contract.setBillingAmout(contract.getBillingAmout().subtract(invoice.getInvoiceTotalPriceTax()));
+ //闃叉閲嶅瀹″紑绁ㄥ鏍搁�氳繃鍚� 寮�绁ㄩ噾棰濅负璐�
+ if (contract.getBillingAmout().compareTo(new BigDecimal("0"))<0){
+ contract.setBillingAmout(new BigDecimal("0"));
+ }
//鏇存柊鍚堝悓寮�绁ㄧ姸鎬� 鍓嶆彁鍑哄簱瀹屾垚
contract.setBillingStatus("2");
contractMapper.updateById(contract);
@@ -807,8 +804,10 @@
if (ArrayUtil.isNotEmpty(outBoundInvoiceVoList.toArray())) {
outBoundInvoiceVoList.stream().forEach(contractOutBoundInvoiceVo -> {
ContractOutBound contractOutBound = contractOutBoundMapper.selectById(contractOutBoundInvoiceVo.getContractOutBoundId());
- contractOutBound.setInvoiceNum(contractOutBound.getInvoiceNum().subtract(contractOutBoundInvoiceVo.getInvoiceNum()));
- contractOutBoundMapper.updateById(contractOutBound);
+ if (contractOutBoundInvoiceVo.getInvoiceNum().compareTo(contractOutBound.getOutBoundNum().subtract(contractOutBound.getInvoiceNum()))<=0) {
+ contractOutBound.setInvoiceNum(contractOutBound.getInvoiceNum().subtract(contractOutBoundInvoiceVo.getInvoiceNum()));
+ contractOutBoundMapper.updateById(contractOutBound);
+ }
});
}
}else {
@@ -841,8 +840,10 @@
if (ArrayUtil.isNotEmpty(outBoundInvoiceVoList.toArray())) {
outBoundInvoiceVoList.stream().forEach(contractOutBoundInvoiceVo -> {
ContractOutBound contractOutBound = contractOutBoundMapper.selectById(contractOutBoundInvoiceVo.getContractOutBoundId());
- contractOutBound.setInvoiceNum(contractOutBound.getInvoiceNum().subtract(contractOutBoundInvoiceVo.getInvoiceNum()));
- contractOutBoundMapper.updateById(contractOutBound);
+ if (contractOutBoundInvoiceVo.getInvoiceNum().compareTo(contractOutBound.getOutBoundNum().subtract(contractOutBound.getInvoiceNum()))<=0) {
+ contractOutBound.setInvoiceNum(contractOutBound.getInvoiceNum().subtract(contractOutBoundInvoiceVo.getInvoiceNum()));
+ contractOutBoundMapper.updateById(contractOutBound);
+ }
});
}
}else {
diff --git a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/ContractServiceImpl.java b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/ContractServiceImpl.java
index 437d9ca..a0d71bb 100644
--- a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/ContractServiceImpl.java
+++ b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/ContractServiceImpl.java
@@ -24,6 +24,7 @@
import com.by4cloud.platformx.business.mapper.*;
import com.by4cloud.platformx.business.service.ContractService;
import com.by4cloud.platformx.business.utils.ItemGeneratorUtil;
+import com.by4cloud.platformx.business.utils.NetworkFileToBase64;
import com.by4cloud.platformx.business.vo.ContractDetailVo;
import com.by4cloud.platformx.business.vo.ContractInvoiceVo;
import com.by4cloud.platformx.business.vo.ContractSlipVo;
@@ -267,7 +268,7 @@
if (StrUtil.isEmpty(updateDTO.getPartyA())){
BusinessCustomer bc = businessCustomerMapper.selectById(updateDTO.getPartyAId());
if (ObjUtil.isNotNull(bc)){
- updateDTO.setPartyA(bc.getRegisterName());
+ updateDTO.setPartyA(bc.getCompanyName());
}
if (StrUtil.isEmpty(bc.getErpCompanyCode())||StrUtil.isEmpty(bc.getRegisterName())||
StrUtil.isEmpty(bc.getBankName())||StrUtil.isEmpty(bc.getBankAccount())){
@@ -719,25 +720,60 @@
//鍚堝悓涓績鎺ㄩ��
new Thread(()->{
try {
- JSONObject request = new JSONObject();
- request.put("fd_docNumber",contract.getContractNo());
- request.put("fd_singer",contract.getNickName());
- request.put("fd_signTime",DateUtil.formatDate(contract.getSignDate()));
- request.put("fd_linkPerson","");
- request.put("fd_linkPhone","");
- request.put("fd_address",contract.getSignPlace());
- request.put("fd_receivedTime",DateUtil.format(contract.getCreateTime(),DatePattern.NORM_DATETIME_PATTERN));
- request.put("fd_receivedNum",1);
- request.put("fd_effedate",DateUtil.formatDate(contract.getEffectiveDate()));
- request.put("fd_enddate",DateUtil.formatDate(contract.getExpirationDate()));
- request.put("fd_reviewerNo",contract.getNickName());
- request.put("fd_docStatus","20");
- request.put("fd_templateId","");
- request.put("fd_attName",contract.getAttachmentName());
- request.put("fd_attcontent",contract.getAttachmentName());
- log.info("鍚堝悓涓績鍚屾鍚堝悓鎺ュ彛鍏ュ弬锛歿}",request.toJSONString());
- String resp = HttpUtil.post("https://oatest.res.jzeg.cn/ekp/api/km-agreement/kmAgreementWebService/addContractReview",request.toJSONString());
- log.info("鍚堝悓涓績鍚屾鍚堝悓鎺ュ彛鍥炲弬锛歿}",resp);
+ JSONObject requestApply = new JSONObject();
+ requestApply.put("fd_selectionmethod","鍏紑鎷涙爣");
+ requestApply.put("fd_isrelated","鏄�");
+ requestApply.put("fd_bizId",contract.getId());
+ requestApply.put("fd_remark",contract.getRemark());
+ requestApply.put("fd_MainContent","");
+ requestApply.put("fd_settlementType","00");
+ requestApply.put("fd_applyType","澶栭攢");
+ requestApply.put("fd_contractsubject ",subjectMatterList.stream().map(item->item.getMaterialName()).collect(Collectors.joining(",")));
+ requestApply.put("fd_docNumber",contract.getContractNo());
+ requestApply.put("fd_templateId","19e39bb6c1edadbdb162c434274a8a18");
+ requestApply.put("fd_name",contract.getContractName());
+ requestApply.put("fd_signDate",DateUtil.formatDate(contract.getSignDate()));
+ requestApply.put("fd_endDate",DateUtil.formatDate(contract.getExpirationDate()));
+ requestApply.put("fd_contractCreater",contract.getNickName());
+ requestApply.put("fd_currency","浜烘皯甯�");
+ requestApply.put("fd_ContractAmount",contract.getAmount());
+ requestApply.put("fd_finAmount",contract.getAmount().divide(new BigDecimal("113"),2,RoundingMode.HALF_UP)
+ .multiply(new BigDecimal("87")));
+ requestApply.put("fd_docStatus","20");
+ requestApply.put("fd_taxRates",13);
+ requestApply.put("fd_customerName",contract.getPartyA());
+ requestApply.put("fd_systemSource","闈炵叅閿�鍞郴缁�");
+ requestApply.put("fd_type","00");
+ log.info("鍚堝悓涓績鍚堝悓璧疯崏鎺ュ彛鍏ュ弬锛歿}",requestApply.toJSONString());
+ String respApply = HttpUtil.post("https://oatest.res.jzeg.cn/ekp/api/km-agreement/kmAgreementWebService/addSupplyContractApply",requestApply.toJSONString());
+ log.info("鍚堝悓涓績鍚堝悓璧疯崏鎺ュ彛鍥炲弬锛歿}",respApply);
+ JSONObject applyResp = JSONObject.parseObject(respApply);
+ if (applyResp.getString("code").equals("00")) {
+ JSONObject request = new JSONObject();
+ request.put("fd_docNumber", contract.getContractNo());
+ request.put("fd_singer", contract.getNickName());
+ request.put("fd_signTime", DateUtil.formatDate(contract.getSignDate()));
+ request.put("fd_linkPerson", "");
+ request.put("fd_linkPhone", "");
+ request.put("fd_address", contract.getSignPlace());
+ request.put("fd_receivedTime", DateUtil.format(contract.getCreateTime(), DatePattern.NORM_DATETIME_PATTERN));
+ request.put("fd_receivedNum", 1);
+ request.put("fd_effedate", DateUtil.formatDate(contract.getSignDate()));
+ request.put("fd_enddate", DateUtil.formatDate(contract.getExpirationDate()));
+ request.put("fd_reviewerNo", contract.getNickName());
+ request.put("fd_docStatus", "20");
+ request.put("fd_templateId", "19e39bb6c1edadbdb162c434274a8a18");
+ request.put("fd_attName", contract.getAttachmentName());
+ request.put("fd_attcontent", NetworkFileToBase64.convertNetworkFileToBase64("https://zbjt.res.jzeg.cn/api" + contract.getAttachmentUrl()));
+ log.info("鍚堝悓涓績鍚屾鍚堝悓鎺ュ彛鍏ュ弬锛歿}", request.toJSONString());
+ String resp = HttpUtil.post("https://oatest.res.jzeg.cn/ekp/api/km-agreement/kmAgreementWebService/addContractReview", request.toJSONString());
+ log.info("鍚堝悓涓績鍚屾鍚堝悓鎺ュ彛鍥炲弬锛歿}", resp);
+ JSONObject respJson = JSONObject.parseObject(resp);
+ if (respJson.getString("code").equals("00")) {
+ contract.setCenterPushFlag("1");
+ baseMapper.updateById(contract);
+ }
+ }
} catch (Exception e) {
e.printStackTrace();
}
@@ -907,6 +943,7 @@
public R copyNewContract(Long id) {
Contract oldContract = baseMapper.selectById(id);
Contract newContract = BeanUtil.copyProperties(oldContract, Contract.class, "id", "createTime");
+ newContract.setOutBoundAmout(new BigDecimal("0"));
newContract.setPaidAmount(new BigDecimal("0"));
newContract.setBillingStatus("1");
newContract.setErpPushFlag("0");
@@ -1579,6 +1616,7 @@
return R.failed("erp瀹㈡埛缂栫爜涓嶅瓨鍦�");
}
contract.setPartyAId(bc.getId());
+ contract.setPartyA(bc.getCompanyName());
if (ObjUtil.isNotNull(addDTO.getDeliveryCycle())){
contract.setExpirationDate(DateUtil.offsetDay(addDTO.getSignDate(),addDTO.getDeliveryCycle()));
}
diff --git a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/OutBoundServiceImpl.java b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/OutBoundServiceImpl.java
index 5f9b207..c0a5002 100644
--- a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/OutBoundServiceImpl.java
+++ b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/OutBoundServiceImpl.java
@@ -711,7 +711,6 @@
List<ContractPaymentSchedule> afterSchedule = scheduleMapper.selectList(Wrappers.<ContractPaymentSchedule>lambdaQuery()
.eq(ContractPaymentSchedule::getContractId, schedule.getContractId())
.gt(ContractPaymentSchedule::getStageOrder, schedule.getStageOrder())
- .gt(ContractPaymentSchedule::getPaymentRatio, 0)
.orderByAsc(ContractPaymentSchedule::getCreateTime));
if (ArrayUtil.isNotEmpty(afterSchedule.toArray())&&contract.getOutBoundAmout().compareTo(contract.getAmount())==0) {
contract.setNextScheduleName(afterSchedule.get(0).getStageName());
diff --git a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/PaymentConfirmServiceImpl.java b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/PaymentConfirmServiceImpl.java
index 43eec9f..fb66342 100644
--- a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/PaymentConfirmServiceImpl.java
+++ b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/PaymentConfirmServiceImpl.java
@@ -15,6 +15,7 @@
import com.by4cloud.platformx.admin.api.feign.RemoteDeptService;
import com.by4cloud.platformx.business.dto.AgingQueryDTO;
import com.by4cloud.platformx.business.dto.PaymentConfirmAddDTO;
+import com.by4cloud.platformx.business.dto.SyncPaymentRecepitDTO;
import com.by4cloud.platformx.business.entity.*;
import com.by4cloud.platformx.business.mapper.*;
import com.by4cloud.platformx.business.service.BusinessCustomerService;
@@ -63,6 +64,7 @@
private final BipRequestRecordMapper bipRequestRecordMapper;
private final ContractExecDateMapper contractExecDateMapper;
private final MeterReadRecordMapper meterReadRecordMapper;
+ private final BankStatementMapper bankStatementMapper;
private final RemoteDeptService remoteDeptService;
private final RedisTemplate redisTemplate;
@@ -105,7 +107,7 @@
//鏂板浠樻鍗�
PaymentSlip slip = new PaymentSlip();
slip.setBusGuestId(customer.getId());
- slip.setBusGuestName(customer.getRegisterName());
+ slip.setBusGuestName(customer.getCompanyName());
slip.setPayeeCompId(SecurityUtils.getUser().getCompId());
slip.setPaymentTime(addDTO.getConfirmTime());
slip.setPaymentAmount(addDTO.getTransationAmount());
@@ -122,7 +124,7 @@
entity.setScheduleName(lastConfirm.getScheduleName());
}
entity.setBusGuestId(customer.getId());
- entity.setBusGuestName(customer.getRegisterName());
+ entity.setBusGuestName(customer.getCompanyName());
entity.setBusinessType("瀹㈡埛浠樻");
if (newtotal.compareTo(new BigDecimal("0")) > 0) {
entity.setTransationAmount(addDTO.getTransationAmount());
@@ -238,7 +240,7 @@
entity.setContractNo(addDTO.getContractNo());
entity.setBusGuestId(customer.getId());
- entity.setBusGuestName(customer.getRegisterName());
+ entity.setBusGuestName(customer.getCompanyName());
entity.setBusinessType("閫�娆�");
entity.setTransationAmount(addDTO.getTransationAmount());
BigDecimal newtotal = addDTO.getTransationAmount().multiply(new BigDecimal("-1")).add(lastConfirm.getTotalAmount());
@@ -479,7 +481,7 @@
}
@Override
- public R syncPaymentRecepit() {
+ public R syncPaymentRecepit(SyncPaymentRecepitDTO dto) {
String accessToken = "";
if (redisTemplate.hasKey("BIP_TOKEN")) {
accessToken = (String) redisTemplate.opsForValue().get("BIP_TOKEN");
@@ -489,10 +491,22 @@
if (StrUtil.isEmpty(accessToken)) {
return R.failed("鑾峰彇token澶辫触");
}
- String[] bipCodeArr = codes.split(",");
+ String[] bipCodeArr = StrUtil.isNotBlank(dto.getBipCode())?dto.getBipCode().split(","):codes.split(",");
for (String bipCode : bipCodeArr) {
//鍏ュ弬
- JSONObject params = genParams(bipCode);
+ JSONObject params = new JSONObject();
+ if (StrUtil.isNotBlank(dto.getStartDate())){
+ params.put("begindate",dto.getStartDate());
+ }else {
+ params.put("begindate", DateUtil.formatDate(DateUtil.offsetDay(new Date(), -1)));
+ }
+ if (StrUtil.isNotBlank(dto.getStartDate())){
+ params.put("enddate", dto.getEndDate());
+ }else {
+ params.put("enddate", DateUtil.today());
+ }
+ //鍗曟嵁鐘舵�佸凡瀹℃壒
+ params.put("accentity_code", bipCode);
String finalAccessToken = accessToken;
new Thread(() -> {
try {
@@ -500,11 +514,11 @@
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
- log.info("SK_CX Request:", params.toJSONString());
- String result = HttpUtil.post(url + "/yonbip/EFI/collection/list?access_token=" + finalAccessToken, params.toJSONString());
- log.info("SK_CX Response:{}", result);
+ log.info("閾惰娴佹按鏌ヨ Request:{}", params.toJSONString());
+ String result = HttpUtil.post(url + "/iuap-api-auth/yonbip/ctm/cmp/bankReconciliationQuery?access_token=" + finalAccessToken, params.toJSONString());
+ log.info("閾惰娴佹按鏌ヨ Response:{}", result);
//淇濆瓨璇锋眰璁板綍
- saveBipRequestRecord(params, "<XSJZ_SK_CX_001>-鏀舵鍗曟煡璇㈡帴鍙�", result);
+ saveBipRequestRecord(params, "閾惰娴佹按鏌ヨ鎺ュ彛", result);
JSONObject resultJson = JSONObject.parseObject(result);
if (resultJson.containsKey("code") && resultJson.getString("code").equals("200")) {
handleAndSave(bipCode, resultJson);
@@ -513,23 +527,6 @@
}).start();
}
return R.ok();
- }
-
- private JSONObject genParams(String bipCode) {
- JSONObject params = new JSONObject();
- params.put("pageIndex", 1);
- params.put("pageSize", 999);
- params.put("open_billDate_begin", DateUtil.offsetDay(new Date(), -1) + " 00:00:00");
- params.put("open_billDate_begin", DateUtil.today() + " 00:00:00");
- //鍗曟嵁鐘舵�佸凡瀹℃壒
- params.put("verifyState", new String[]{"2"});
- //寰�鏉ュ璞″鎴�
- params.put("objectType", new String[]{"1"});
- //鍗曚綅
- JSONObject simpleMap = new JSONObject();
- simpleMap.put("financeOrg.code", bipCode);
- params.put("simple", simpleMap);
- return params;
}
@Override
@@ -550,9 +547,9 @@
}
String getTokenResult = HttpUtil.get(url + "/iuap-api-auth/open-auth/selfAppAuth/getAccessToken?appKey=" + appKey + "×tamp=" + timestamp
+ "&signature=" + signature);
- log.info("Get access_token Response:", getTokenResult);
+ log.info("Get access_token Response:{}", getTokenResult);
JSONObject tokenJson = JSONObject.parseObject(getTokenResult);
- if (!tokenJson.containsKey("code") || !tokenJson.getString("code").equals("200")) {
+ if (!tokenJson.containsKey("code") || !tokenJson.getString("code").equals("00000")) {
log.error("Get access_token ERROR");
return "";
}
@@ -561,8 +558,8 @@
return "";
}
accessToken = JSONObject.parseObject(tokenJson.getString("data")).getString("access_token");
- log.info("access_token value:", accessToken);
- redisTemplate.opsForValue().set("BIP_TOKEN", accessToken, tokenJson.getIntValue("expire") - 10, TimeUnit.SECONDS);
+ log.info("access_token value:{}", accessToken);
+ redisTemplate.opsForValue().set("BIP_TOKEN", accessToken, JSONObject.parseObject(tokenJson.getString("data")).getIntValue("expire") - 10, TimeUnit.SECONDS);
return accessToken;
}
@@ -593,291 +590,63 @@
log.error("杩斿洖缁撴灉涓璻ecordList涓虹┖");
return;
}
- log.info("==================寮�濮嬪鐞嗘敹娆惧崟淇℃伅===================");
+ log.info("==================寮�濮嬪鐞嗛摱琛屾祦姘翠俊鎭�===================");
recordList.stream().forEach(record -> {
savePaymentConfirm((JSONObject) record, dept);
});
- log.info("==================缁撴潫澶勭悊鏀舵鍗曚俊鎭�===================");
+ log.info("==================缁撴潫澶勭悊閾惰娴佹按淇℃伅===================");
}
private void savePaymentConfirm(JSONObject record, SysDept dept) {
- List<Contract> contractList = contractService.list(Wrappers.<Contract>lambdaQuery().eq(Contract::getPartyA, record.getString("bodyItemCustomerName"))
- .eq(Contract::getPartyBId, dept.getDeptId()).orderByAsc(Contract::getCreateTime));
- if (ArrayUtil.isEmpty(contractList.toArray())) {
- log.error("浠樻鍗昳d锛歿},鐢叉柟锛歿},涔欐柟锛歿},鏃犵浉鍏冲悎鍚�", record.getString("id"), record.getString("bodyItemCustomerName"), dept.getName());
+ if (record.containsKey("to_acct_name")){
+ log.error("浠樻鍗昳d锛歿},浠樻鍏徃涓虹┖", record.getString("id"));
return;
}
BusinessCustomer customer = businessCustomerService.getOne(Wrappers.<BusinessCustomer>lambdaQuery()
- .eq(StrUtil.isNotBlank(record.getString("bodyItemCustomerName")), BusinessCustomer::getRegisterName, record.getString("bodyItemCustomerName"))
+ .eq(BusinessCustomer::getCompanyName, record.getString("to_acct_name"))
+ .eq(BusinessCustomer::getCompId,dept.getDeptId())
);
if (ObjUtil.isNull(customer)) {
log.error("浠樻鍗昳d锛歿},瀹㈠晢鏌ヨ澶辫触锛岃妫�鏌ュ鍟�", record.getString("id"));
return;
}
- if (ObjUtil.isNull(record.getBigDecimal("bodyItemOriTaxExcludedAmount"))) {
- log.error("浠樻鍗昳d锛歿},浠樻鍗曟棤绋庨噾棰濓紝寮傚父", record.getString("id"));
+ if (ObjUtil.isNull(record.getBigDecimal("tran_amt"))) {
+ log.error("浠樻鍗昳d锛歿},浜ゆ槗閲戦寮傚父", record.getString("id"));
return;
}
//淇濆瓨浠樻鍗�
- Boolean codeFlag = savePaymentSlip(customer, record, dept);
+ Boolean codeFlag = saveBankStatement(customer, record);
if (codeFlag) {
log.error("浠樻鍗昳d锛歿},浠樻鍗曞凡瀛樺湪");
return;
}
- BigDecimal transtionAmount = record.getBigDecimal("bodyItemOriTaxExcludedAmount");
- //鍓╀綑浠樻
- BigDecimal transtionRemainAmount = transtionAmount;
- //鏀跺埌浠樻鐨勫悎鍚�
- List<Contract> payContractList = new ArrayList<>();
- //浠樻瀹屾垚鐨勫悎鍚�
- List<Contract> payCompleteContractList = new ArrayList<>();
- //浠樻鏈畬鎴愮殑鍚堝悓
- List<Contract> payNoCompleteContractList = new ArrayList<>();
- //鏈夐浠樻鐨勫悎鍚�
- List<Contract> advanceContractList = new ArrayList<>();
- //浠樻鏃堕棿
- Date payDate = DateUtil.parse(record.getString("billDate"), DatePattern.NORM_DATETIME_FORMAT);
- Iterator<Contract> iterator = contractList.iterator();
- while (iterator.hasNext()) {
- Contract contract = iterator.next();
- PaymentConfirm lastConfirm = baseMapper.selectOne(Wrappers.<PaymentConfirm>lambdaQuery().eq(PaymentConfirm::getContractId, contract.getId())
- .orderByDesc(PaymentConfirm::getCreateTime).last("limit 1"));
- BigDecimal lastTotal = new BigDecimal("0");
- if (ObjUtil.isNotNull(lastConfirm)) {
- lastTotal = lastConfirm.getTotalAmount();
- }
- //鍚堝悓鏈�杩戞槑缁嗘�婚涓�0 鎴� > 0 鎯呭喌涓�
- if (lastTotal.compareTo(new BigDecimal("0")) >= 0) {
- log.info("褰撳墠鍚堝悓鍙凤細{},鏄庣粏鎬婚鏃犲簲鏀舵", contract.getContractNo());
- advanceContractList.add(contract);
- continue;
- }
-
- transtionRemainAmount = transtionRemainAmount.add(lastTotal);
- PaymentConfirm entity = new PaymentConfirm();
- entity.setContractId(contract.getId());
- entity.setContractName(contract.getContractName());
- entity.setContractNo(contract.getContractNo());
- if (ObjUtil.isNotNull(lastConfirm)) {
- entity.setScheduleId(lastConfirm.getScheduleId());
- entity.setScheduleName(lastConfirm.getScheduleName());
- }
- entity.setBusGuestId(customer.getId());
- entity.setBusGuestName(customer.getRegisterName());
- entity.setBusinessType("瀹㈡埛浠樻");
- entity.setIsBip(1);
- entity.setPaymentCode(record.getString("code"));
- entity.setPayType(record.get("bodyItemSettleModeName") != null ? record.getString("bodyItemSettleModeName").contains("鎵垮厬姹囩エ") ? 1 : 0 : null);
- entity.setBipId(record.getString("id"));
- if (transtionRemainAmount.compareTo(new BigDecimal("0")) > 0) {
- entity.setConfirmTime(payDate);
- // 鍒ゆ柇鏄惁鏄渶鍚庝竴涓�
- if (!iterator.hasNext()) {
- entity.setTransationAmount(transtionRemainAmount.subtract(lastTotal));
- entity.setAdvanceAmount(transtionRemainAmount);
- entity.setTotalAmount(transtionRemainAmount);
- } else {
- entity.setTransationAmount(lastTotal.multiply(new BigDecimal("-1")));
- entity.setTotalAmount(new BigDecimal("0"));
- }
- baseMapper.insert(entity);
- } else if (transtionRemainAmount.compareTo(new BigDecimal("0")) == 0) {
- entity.setTransationAmount(lastTotal.multiply(new BigDecimal("-1")));
- entity.setTotalAmount(new BigDecimal("0"));
- entity.setConfirmTime(payDate);
- baseMapper.insert(entity);
- break;
- } else {
- entity.setTransationAmount(transtionRemainAmount.subtract(lastTotal));
- entity.setTotalAmount(transtionAmount);
- entity.setConfirmTime(payDate);
- baseMapper.insert(entity);
- break;
- }
- }
-
- payContractList.stream().forEach(contract -> {
- //鏇存柊浠樻闃舵浠樻
- List<ContractPaymentSchedule> scheduleList = contractPaymentScheduleMapper.selectList(Wrappers.<ContractPaymentSchedule>lambdaQuery()
- .eq(ContractPaymentSchedule::getContractId, contract.getId()).ne(ContractPaymentSchedule::getPaymentStatus, 2).ne(ContractPaymentSchedule::getPaymentStatus, 3)
- .orderByAsc(ContractPaymentSchedule::getCreateTime));
- if (ArrayUtil.isNotEmpty(scheduleList.toArray())) {
- BigDecimal remain = transtionAmount;
- for (ContractPaymentSchedule schedule : scheduleList) {
- BigDecimal lastRemain = remain;
- remain = remain.subtract(StrUtil.equals(schedule.getPaymentStatus() + "", "0") ? schedule.getPlannedAmount() :
- schedule.getPlannedAmount().subtract(schedule.getActualAmount()));
- if (remain.compareTo(new BigDecimal("0")) >= 0) {
- schedule.setActualAmount(schedule.getPlannedAmount());
- schedule.setPaymentDate(payDate);
- schedule.setPaymentStatus(2);
- contractPaymentScheduleMapper.updateById(schedule);
- //鏌ヨ鏄惁鏈夊綋鍓嶉�炬湡
- CurrentOverdue currentOverdue = currentOverdueMapper.selectOne(Wrappers.<CurrentOverdue>lambdaQuery().eq(CurrentOverdue::getScheduleId, schedule.getId())
- .eq(CurrentOverdue::getContractId, schedule.getContractId()).last("limit 1"));
- if (ObjUtil.isNotNull(currentOverdue)) {
- //鏂板閫炬湡鍘嗗彶
- HistoryOverdue historyOverdue = BeanUtil.copyProperties(currentOverdue, HistoryOverdue.class, "id");
- historyOverdue.setPaymentTime(payDate);
- historyOverdue.setCompId(schedule.getCompId());
- historyOverdueMapper.insert(historyOverdue);
- //鍒犻櫎褰撳墠閫炬湡
- currentOverdueMapper.deleteById(currentOverdue);
- }
- } else {
- schedule.setActualAmount(StrUtil.equals(schedule.getPaymentStatus() + "", "0") ? schedule.getPlannedAmount().add(remain) :
- schedule.getActualAmount().add(lastRemain));
- schedule.setPaymentDate(payDate);
- schedule.setPaymentStatus(1);
- contractPaymentScheduleMapper.updateById(schedule);
- //鏌ヨ鏄惁鏈夊綋鍓嶉�炬湡
- CurrentOverdue currentOverdue = currentOverdueMapper.selectOne(Wrappers.<CurrentOverdue>lambdaQuery().eq(CurrentOverdue::getScheduleId, schedule.getId())
- .eq(CurrentOverdue::getContractId, schedule.getContractId()).last("limit 1"));
- if (ObjUtil.isNotNull(currentOverdue)) {
- //鏂板閫炬湡鍘嗗彶
- HistoryOverdue historyOverdue = BeanUtil.copyProperties(currentOverdue, HistoryOverdue.class, "id");
- historyOverdue.setReceivableAmount(lastRemain);
- historyOverdue.setPaymentTime(payDate);
- historyOverdue.setCompId(schedule.getCompId());
- historyOverdueMapper.insert(historyOverdue);
- //鏌ヨ鍘嗗彶宸蹭粯閫炬湡閲戦
- List<HistoryOverdue> historyOverdueList = historyOverdueMapper.selectList(Wrappers.<HistoryOverdue>lambdaQuery().eq(HistoryOverdue::getScheduleId, currentOverdue.getScheduleId()));
- BigDecimal hisTotal = historyOverdueList.stream().map(item -> item.getReceivableAmount()).reduce(BigDecimal.ZERO, BigDecimal::add);
- //鏇存柊褰撳墠閫炬湡
- currentOverdue.setReceivableAmount(schedule.getPlannedAmount().subtract(hisTotal));
- currentOverdueMapper.updateById(currentOverdue);
- }
- break;
- }
- }
- }
- //鍚堝悓鎵�鏈変粯娆鹃樁娈�
- List<ContractPaymentSchedule> payComScheduleList = contractPaymentScheduleMapper.selectList(Wrappers.<ContractPaymentSchedule>lambdaQuery()
- .eq(ContractPaymentSchedule::getContractId, contract.getId()).ne(ContractPaymentSchedule::getPaymentStatus, 0).ne(ContractPaymentSchedule::getPaymentStatus, 3)
- );
- if (ArrayUtil.isNotEmpty(payComScheduleList.toArray())) {
- BigDecimal payTotal = payComScheduleList.stream().map(item -> StrUtil.equals(item.getPaymentStatus() + "", "0") ? item.getPlannedAmount() :
- item.getActualAmount()).reduce(BigDecimal.ZERO, BigDecimal::add);
- contract.setPaidAmount(payTotal);
-// if (payComScheduleList.stream().allMatch(item -> Objects.equals(item.getPaymentStatus(), 2))) {
-// contract.setContractStatus(3);
-// }
-// contractService.updateById(contract);
-// if (contract.getAmount().compareTo(contract.getPaidAmount()) == 0) {
-// payCompleteContractList.add(contract);
-// }
- if (contract.getAmount().compareTo(contract.getPaidAmount()) == 0) {
-// contract.setBillingStatus("2");
- contract.setContractStatus(3);
- payCompleteContractList.add(contract);
- }
- //浠樻 涓� 浠樻鏈叏浠�
- if (contract.getAmount().compareTo(contract.getPaidAmount()) > 0) {
- payNoCompleteContractList.add(contract);
- }
- if (StrUtil.isNotEmpty(contract.getContractCategory()) && StrUtil.equals(contract.getContractCategory(), "water_house")) {
- List<ContractExecDate> execDateList = contractExecDateMapper.selectList(Wrappers.<ContractExecDate>lambdaQuery()
- .eq(ContractExecDate::getContractId, contract.getId()).eq(ContractExecDate::getGenFlag, "0"));
- if (ArrayUtil.isEmpty(execDateList)) {
- List<ContractPaymentSchedule> contractPaymentScheduleList = contractPaymentScheduleMapper.selectList(Wrappers.<ContractPaymentSchedule>lambdaQuery()
- .eq(ContractPaymentSchedule::getContractId, contract.getId()));
- if (ArrayUtil.isNotEmpty(contractPaymentScheduleList.toArray()) && contractPaymentScheduleList.stream().allMatch(item -> Objects.equals(item.getPaymentStatus(), 2))) {
- contract.setContractStatus(3);
- contractService.updateById(contract);
- }
- }
- } else {
- contractService.updateById(contract);
- }
- }
- });
-
- //瀹㈡埛棰勪粯鏈夊墿浣� 涓� 鏈夐浠樻鐨勫悎鍚�
-// if (transtionRemainAmount.compareTo(new BigDecimal("0")) > 0) {
-// if (ArrayUtil.isNotEmpty(payNoCompleteContractList.toArray())){
-// //浣欓 鏀惧埌浠樻鏈畬鎴愬悎鍚� 棰勬敹
-// Contract lastContract = payNoCompleteContractList.get(payNoCompleteContractList.size() - 1);
-// //淇濆瓨鏄庣粏
-// saveNewPaymentConfirm(customer,record,lastContract,transtionRemainAmount,payDate);
-// }
-// if (ArrayUtil.isEmpty(payNoCompleteContractList.toArray())&&ArrayUtil.isNotEmpty(advanceContractList.toArray())){
-// //瀹㈡埛棰勪粯鏈夊墿浣� 娌℃湁棰勪粯娆剧殑鍚堝悓
-// Contract lastContract = payNoCompleteContractList.get(payNoCompleteContractList.size() - 1);
-// //淇濆瓨鏄庣粏
-// saveNewPaymentConfirm(customer,record,lastContract,transtionRemainAmount,payDate);
-// }
-// if (ArrayUtil.isEmpty(payNoCompleteContractList.toArray())&&ArrayUtil.isEmpty(advanceContractList.toArray())
-// &&ArrayUtil.isNotEmpty(payCompleteContractList.toArray())) {
-// //瀹㈡埛棰勪粯鏈夊墿浣� 娌℃湁棰勪粯娆剧殑鍚堝悓
-// Contract lastContract = payCompleteContractList.get(payCompleteContractList.size() - 1);
-// //淇濆瓨鏄庣粏
-// saveNewPaymentConfirm(customer,record,lastContract,transtionRemainAmount,payDate);
-//
-// }
-// }
}
- private Boolean savePaymentSlip(BusinessCustomer customer, JSONObject record, SysDept dept) {
- PaymentSlip slip = new PaymentSlip();
- slip.setBusGuestId(customer.getId());
- slip.setBusGuestName(customer.getRegisterName());
- slip.setPayee(dept.getName());
- slip.setPayeeCompId(dept.getDeptId());
- slip.setPaymentTime(ObjUtil.isNotNull(record.get("billDate")) ?
- DateUtil.parse(record.getString("billDate"), DatePattern.NORM_DATETIME_FORMAT) : new Date());
- slip.setPaymentAmount(ObjUtil.isNotNull(record.get("bodyItemOriTaxExcludedAmount")) ? record.getBigDecimal("bodyItemOriTaxExcludedAmount") : new BigDecimal("0"));
- slip.setPayType(ObjUtil.isNotNull(record.get("bodyItemSettleModeName")) ? record.getString("bodyItemSettleModeName") : "");
- if (ObjUtil.isNotNull(record.get("code"))) {
- slip.setPaymentNumber(record.getString("code"));
- PaymentSlip paymentSlip = paymentSlipMapper.selectOne(Wrappers.<PaymentSlip>lambdaQuery().eq(PaymentSlip::getPaymentNumber, slip.getPaymentNumber()));
- if (ObjUtil.isNull(paymentSlip)) {
- paymentSlipMapper.insert(slip);
- return false;
- }
+ private Boolean saveBankStatement(BusinessCustomer customer, JSONObject record) {
+ BankStatement bankStatement = new BankStatement();
+ bankStatement.setBankSeqNo(record.getString("bank_seq_no"));
+ bankStatement.setReceiveBankAcc(record.getString("bank_seq_no"));
+ bankStatement.setReceiveBankAccAcc(record.getString("bankaccount_account"));
+ bankStatement.setReceiveBankAccName(record.getString("bankaccount_acctName"));
+ bankStatement.setPayBankNo(record.getString("to_acct_no"));
+ bankStatement.setPayBankAccName(record.getString("to_acct_name"));
+ bankStatement.setTranDate(DateUtil.parseDateTime(record.getString("tran_date")));
+ bankStatement.setTranAmount(record.getBigDecimal("tran_amt"));
+ bankStatement.setDataId(record.getLong("id"));
+ bankStatement.setDataJson(record.toJSONString());
+ bankStatement.setBusGuestId(customer.getId());
+ BankStatement statement = bankStatementMapper.selectOne(Wrappers.<BankStatement>lambdaQuery().eq(BankStatement::getDataId,record.getLong("id")));
+ if (ObjUtil.isNotNull(statement)){
+ return false;
}
+ statement.setCompId(customer.getCompId());
+ bankStatementMapper.insert(bankStatement);
return true;
}
- public void saveNewPaymentConfirm(BusinessCustomer customer, JSONObject record, Contract contract, BigDecimal transtionRemainAmount
- , Date payDate) {
- PaymentConfirm entity = new PaymentConfirm();
- entity.setContractId(contract.getId());
- entity.setContractName(contract.getContractName());
- entity.setContractNo(contract.getContractNo());
- PaymentConfirm lastConfirm = baseMapper.selectOne(Wrappers.<PaymentConfirm>lambdaQuery().eq(PaymentConfirm::getContractId, contract.getId())
- .orderByDesc(PaymentConfirm::getCreateTime).last("limit 1"));
- BigDecimal lastTotal = new BigDecimal("0");
- if (ObjUtil.isNotNull(lastConfirm)) {
- lastTotal = lastConfirm.getTotalAmount();
- }
-
- if (ObjUtil.isNotNull(lastConfirm)) {
- entity.setScheduleId(lastConfirm.getScheduleId());
- entity.setScheduleName(lastConfirm.getScheduleName());
- }
-
- entity.setBusGuestId(customer.getId());
- entity.setBusGuestName(customer.getRegisterName());
- entity.setBusinessType("瀹㈡埛浠樻");
- if (ObjUtil.isNotNull(record)) {
- entity.setIsBip(1);
- entity.setPaymentCode(record.getString("code"));
- entity.setPayType(record.get("bodyItemSettleModeName") != null ? record.getString("bodyItemSettleModeName").contains("鎵垮厬姹囩エ") ? 1 : 0 : null);
- entity.setBipId(record.getString("id"));
- }
- entity.setConfirmTime(payDate);
- entity.setTransationAmount(transtionRemainAmount);
- entity.setTotalAmount(transtionRemainAmount.add(lastTotal));
- if (entity.getTotalAmount().compareTo(new BigDecimal("0")) > 0) {
- entity.setAdvanceAmount(entity.getTotalAmount());
- } else if (entity.getTotalAmount().compareTo(new BigDecimal("0")) < 0) {
- entity.setReceivableAmount(entity.getTotalAmount().multiply(new BigDecimal("-1")));
- }
- baseMapper.insert(entity);
- }
@Override
public R queryAllBusinessType() {
@@ -903,12 +672,12 @@
//琛ュ叏鏁版嵁
if (ArrayUtil.isEmpty(companyAgingVo.toArray())) {
companyAgingVo = new ArrayList<>();
- AgingVo agingVo1 = new AgingVo("0-30澶�", new BigDecimal("0"), null);
- AgingVo agingVo2 = new AgingVo("31-60澶�", new BigDecimal("0"), null);
- AgingVo agingVo3 = new AgingVo("61-90澶�", new BigDecimal("0"), null);
- AgingVo agingVo4 = new AgingVo("91-180澶�", new BigDecimal("0"), null);
- AgingVo agingVo5 = new AgingVo("181-365澶�", new BigDecimal("0"), null);
- AgingVo agingVo6 = new AgingVo("1骞翠互涓�", new BigDecimal("0"), null);
+ AgingVo agingVo1 = new AgingVo(1L,"0-30澶�", new BigDecimal("0"), null);
+ AgingVo agingVo2 = new AgingVo(2L,"31-60澶�", new BigDecimal("0"), null);
+ AgingVo agingVo3 = new AgingVo(3L,"61-90澶�", new BigDecimal("0"), null);
+ AgingVo agingVo4 = new AgingVo(4L,"91-180澶�", new BigDecimal("0"), null);
+ AgingVo agingVo5 = new AgingVo(5L,"181-365澶�", new BigDecimal("0"), null);
+ AgingVo agingVo6 = new AgingVo(6L,"1骞翠互涓�", new BigDecimal("0"), null);
companyAgingVo.add(agingVo1);
companyAgingVo.add(agingVo2);
companyAgingVo.add(agingVo3);
@@ -918,27 +687,27 @@
} else {
List<String> overdueRanges = companyAgingVo.stream().map(AgingVo::getOverdueRange).collect(Collectors.toList());
if (!ArrayUtil.contains(overdueRanges.toArray(), "0-30澶�")) {
- AgingVo agingVo1 = new AgingVo("0-30澶�", new BigDecimal("0"), null);
+ AgingVo agingVo1 = new AgingVo(1L,"0-30澶�", new BigDecimal("0"), null);
companyAgingVo.add(agingVo1);
}
if (!ArrayUtil.contains(overdueRanges.toArray(), "31-60澶�")) {
- AgingVo agingVo2 = new AgingVo("31-60澶�", new BigDecimal("0"), null);
+ AgingVo agingVo2 = new AgingVo(2L,"31-60澶�", new BigDecimal("0"), null);
companyAgingVo.add(agingVo2);
}
if (!ArrayUtil.contains(overdueRanges.toArray(), "61-90澶�")) {
- AgingVo agingVo3 = new AgingVo("61-90澶�", new BigDecimal("0"), null);
+ AgingVo agingVo3 = new AgingVo(3L,"61-90澶�", new BigDecimal("0"), null);
companyAgingVo.add(agingVo3);
}
if (!ArrayUtil.contains(overdueRanges.toArray(), "91-180澶�")) {
- AgingVo agingVo4 = new AgingVo("91-180澶�", new BigDecimal("0"), null);
+ AgingVo agingVo4 = new AgingVo(4L,"91-180澶�", new BigDecimal("0"), null);
companyAgingVo.add(agingVo4);
}
if (!ArrayUtil.contains(overdueRanges.toArray(), "181-365澶�")) {
- AgingVo agingVo5 = new AgingVo("181-365澶�", new BigDecimal("0"), null);
+ AgingVo agingVo5 = new AgingVo(5L,"181-365澶�", new BigDecimal("0"), null);
companyAgingVo.add(agingVo5);
}
if (!ArrayUtil.contains(overdueRanges.toArray(), "1骞翠互涓�")) {
- AgingVo agingVo6 = new AgingVo("1骞翠互涓�", new BigDecimal("0"), null);
+ AgingVo agingVo6 = new AgingVo(6L,"1骞翠互涓�", new BigDecimal("0"), null);
companyAgingVo.add(agingVo6);
}
}
diff --git a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/PaymentOffsetServiceImpl.java b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/PaymentOffsetServiceImpl.java
index b10fb15..5fe305a 100644
--- a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/PaymentOffsetServiceImpl.java
+++ b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/PaymentOffsetServiceImpl.java
@@ -31,6 +31,7 @@
private final ContractService contractService;
private final PaymentConfirmMapper paymentConfirmMapper;
+ private final BusinessCustomerMapper businessCustomerMapper;
private final ContractPaymentScheduleMapper contractPaymentScheduleMapper;
private final CurrentOverdueMapper currentOverdueMapper;
private final HistoryOverdueMapper historyOverdueMapper;
@@ -40,13 +41,14 @@
@Override
public R add(PaymentOffset paymentOffset) {
baseMapper.insert(paymentOffset);
+ BusinessCustomer customer = businessCustomerMapper.selectById(paymentOffset.getBusGuestId());
Contract contract = contractService.getById(paymentOffset.getContractId());
//鏂板浠樻鍗�
PaymentSlip slip = new PaymentSlip();
slip.setBusGuestId(paymentOffset.getBusGuestId());
- slip.setBusGuestName(paymentOffset.getBusGuestName());
+ slip.setBusGuestName(customer.getCompanyName());
slip.setPayeeCompId(contract.getPartyBId());
slip.setPayee(contract.getPartyB());
slip.setPaymentTime(paymentOffset.getOffsetTime());
@@ -67,7 +69,7 @@
entity.setContractName(contract.getContractName());
entity.setContractNo(contract.getContractNo());
entity.setBusGuestId(paymentOffset.getBusGuestId());
- entity.setBusGuestName(paymentOffset.getBusGuestName());
+ entity.setBusGuestName(customer.getCompanyName());
entity.setBusinessType("鎶垫姽璐�");
entity.setConfirmTime(paymentOffset.getOffsetTime());
entity.setTransationAmount(paymentOffset.getOffsetAmount());
diff --git a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/StatisticServiceImpl.java b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/StatisticServiceImpl.java
index 93c519e..98f4ba0 100644
--- a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/StatisticServiceImpl.java
+++ b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/StatisticServiceImpl.java
@@ -30,6 +30,7 @@
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.ArrayList;
+import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
@@ -372,9 +373,19 @@
// if (ArrayUtil.isEmpty(companys.toArray())){
// return R.failed("鏆傛棤璐﹂緞");
// }
+ List<Long> compIds = new ArrayList<>();
+ compIds.add(Long.valueOf(sgb));
+ compIds.add(Long.valueOf(smj));
+ compIds.add(Long.valueOf(tfgs));
+ compIds.add(Long.valueOf(ymj));
+ compIds.add(Long.valueOf(jxc));
+
List<AgingAnalysisVo> result = new ArrayList<>();
AgingQueryDTO queryDTO = new AgingQueryDTO();
- List<AgingVo> agingVoList = contractPaymentScheduleMapper.selectAgingTotal(null);
+ if (ArrayUtil.contains(compIds.toArray(),SecurityUtils.getUser().getCompId())){
+ queryDTO.setCompanyId(SecurityUtils.getUser().getCompId());
+ }
+ List<AgingVo> agingVoList = contractPaymentScheduleMapper.selectAgingTotal(queryDTO);
items.stream().forEach(item->{
AgingAnalysisVo agingAnalysisVo = new AgingAnalysisVo();
agingAnalysisVo.setCompanyName(item.getLabel());
@@ -383,12 +394,12 @@
//琛ュ叏鏁版嵁
if (ArrayUtil.isEmpty(companyAgingVo.toArray())){
companyAgingVo = new ArrayList<>();
- AgingVo agingVo1 = new AgingVo("0-30澶�",new BigDecimal("0"),null);
- AgingVo agingVo2 = new AgingVo("31-60澶�",new BigDecimal("0"),null);
- AgingVo agingVo3 = new AgingVo("61-90澶�",new BigDecimal("0"),null);
- AgingVo agingVo4 = new AgingVo("91-180澶�",new BigDecimal("0"),null);
- AgingVo agingVo5 = new AgingVo("181-365澶�",new BigDecimal("0"),null);
- AgingVo agingVo6 = new AgingVo("1骞翠互涓�",new BigDecimal("0"),null);
+ AgingVo agingVo1 = new AgingVo(1L,"0-30澶�",new BigDecimal("0"),null);
+ AgingVo agingVo2 = new AgingVo(2L,"31-60澶�",new BigDecimal("0"),null);
+ AgingVo agingVo3 = new AgingVo(3L,"61-90澶�",new BigDecimal("0"),null);
+ AgingVo agingVo4 = new AgingVo(4L,"91-180澶�",new BigDecimal("0"),null);
+ AgingVo agingVo5 = new AgingVo(5L,"181-365澶�",new BigDecimal("0"),null);
+ AgingVo agingVo6 = new AgingVo(6L,"1骞翠互涓�",new BigDecimal("0"),null);
companyAgingVo.add(agingVo1);
companyAgingVo.add(agingVo2);
companyAgingVo.add(agingVo3);
@@ -398,30 +409,31 @@
}else {
List<String> overdueRanges = companyAgingVo.stream().map(AgingVo::getOverdueRange).collect(Collectors.toList());
if (!ArrayUtil.contains(overdueRanges.toArray(),"0-30澶�")){
- AgingVo agingVo1 = new AgingVo("0-30澶�",new BigDecimal("0"),null);
+ AgingVo agingVo1 = new AgingVo(1L,"0-30澶�",new BigDecimal("0"),null);
companyAgingVo.add(agingVo1);
}
if (!ArrayUtil.contains(overdueRanges.toArray(),"31-60澶�")){
- AgingVo agingVo2 = new AgingVo("31-60澶�",new BigDecimal("0"),null);
+ AgingVo agingVo2 = new AgingVo(2L,"31-60澶�",new BigDecimal("0"),null);
companyAgingVo.add(agingVo2);
}
if (!ArrayUtil.contains(overdueRanges.toArray(),"61-90澶�")){
- AgingVo agingVo3 = new AgingVo("61-90澶�",new BigDecimal("0"),null);
+ AgingVo agingVo3 = new AgingVo(3L,"61-90澶�",new BigDecimal("0"),null);
companyAgingVo.add(agingVo3);
}
if (!ArrayUtil.contains(overdueRanges.toArray(),"91-180澶�")){
- AgingVo agingVo4 = new AgingVo("91-180澶�",new BigDecimal("0"),null);
+ AgingVo agingVo4 = new AgingVo(4L,"91-180澶�",new BigDecimal("0"),null);
companyAgingVo.add(agingVo4);
}
if (!ArrayUtil.contains(overdueRanges.toArray(),"181-365澶�")){
- AgingVo agingVo5 = new AgingVo("181-365澶�",new BigDecimal("0"),null);
+ AgingVo agingVo5 = new AgingVo(5L,"181-365澶�",new BigDecimal("0"),null);
companyAgingVo.add(agingVo5);
}
if (!ArrayUtil.contains(overdueRanges.toArray(),"1骞翠互涓�")){
- AgingVo agingVo6 = new AgingVo("1骞翠互涓�",new BigDecimal("0"),null);
+ AgingVo agingVo6 = new AgingVo(6L,"1骞翠互涓�",new BigDecimal("0"),null);
companyAgingVo.add(agingVo6);
}
}
+ companyAgingVo.sort(Comparator.comparing(AgingVo::getSort));
agingAnalysisVo.setAmount(companyAgingVo.stream().map(AgingVo::getTotalAmount).collect(Collectors.toList()));
List<AgingVo> finalCompanyAgingVo = companyAgingVo;
agingAnalysisVo.setPercent(IntStream.range(0, agingVoList.size())
@@ -464,9 +476,19 @@
if (ArrayUtil.isEmpty(items.toArray())){
return R.failed("琛屼笟瀛楀吀鍒嗙被鑾峰彇寮傚父");
}
+ List<Long> compIds = new ArrayList<>();
+ compIds.add(Long.valueOf(sgb));
+ compIds.add(Long.valueOf(smj));
+ compIds.add(Long.valueOf(tfgs));
+ compIds.add(Long.valueOf(ymj));
+ compIds.add(Long.valueOf(jxc));
+
List<AgingAnalysisVo> result = new ArrayList<>();
AgingQueryDTO queryDTO = new AgingQueryDTO();
- List<AgingVo> agingVoList = contractPaymentScheduleMapper.selectAgingTotal(null);
+ if (ArrayUtil.contains(compIds.toArray(),SecurityUtils.getUser().getCompId())){
+ queryDTO.setCompanyId(SecurityUtils.getUser().getCompId());
+ }
+ List<AgingVo> agingVoList = contractPaymentScheduleMapper.selectAgingTotal(queryDTO);
items.stream().forEach(item->{
AgingAnalysisVo agingAnalysisVo = new AgingAnalysisVo();
agingAnalysisVo.setCompanyName(item.getLabel());
@@ -475,12 +497,12 @@
//琛ュ叏鏁版嵁
if (ArrayUtil.isEmpty(companyAgingVo.toArray())){
companyAgingVo = new ArrayList<>();
- AgingVo agingVo1 = new AgingVo("0-30澶�",new BigDecimal("0"),null);
- AgingVo agingVo2 = new AgingVo("31-60澶�",new BigDecimal("0"),null);
- AgingVo agingVo3 = new AgingVo("61-90澶�",new BigDecimal("0"),null);
- AgingVo agingVo4 = new AgingVo("91-180澶�",new BigDecimal("0"),null);
- AgingVo agingVo5 = new AgingVo("181-365澶�",new BigDecimal("0"),null);
- AgingVo agingVo6 = new AgingVo("1骞翠互涓�",new BigDecimal("0"),null);
+ AgingVo agingVo1 = new AgingVo(1L,"0-30澶�",new BigDecimal("0"),null);
+ AgingVo agingVo2 = new AgingVo(2L,"31-60澶�",new BigDecimal("0"),null);
+ AgingVo agingVo3 = new AgingVo(3L,"61-90澶�",new BigDecimal("0"),null);
+ AgingVo agingVo4 = new AgingVo(4L,"91-180澶�",new BigDecimal("0"),null);
+ AgingVo agingVo5 = new AgingVo(5L,"181-365澶�",new BigDecimal("0"),null);
+ AgingVo agingVo6 = new AgingVo(6L,"1骞翠互涓�",new BigDecimal("0"),null);
companyAgingVo.add(agingVo1);
companyAgingVo.add(agingVo2);
companyAgingVo.add(agingVo3);
@@ -490,30 +512,31 @@
}else {
List<String> overdueRanges = companyAgingVo.stream().map(AgingVo::getOverdueRange).collect(Collectors.toList());
if (!ArrayUtil.contains(overdueRanges.toArray(),"0-30澶�")){
- AgingVo agingVo1 = new AgingVo("0-30澶�",new BigDecimal("0"),null);
+ AgingVo agingVo1 = new AgingVo(1L,"0-30澶�",new BigDecimal("0"),null);
companyAgingVo.add(agingVo1);
}
if (!ArrayUtil.contains(overdueRanges.toArray(),"31-60澶�")){
- AgingVo agingVo2 = new AgingVo("31-60澶�",new BigDecimal("0"),null);
+ AgingVo agingVo2 = new AgingVo(2L,"31-60澶�",new BigDecimal("0"),null);
companyAgingVo.add(agingVo2);
}
if (!ArrayUtil.contains(overdueRanges.toArray(),"61-90澶�")){
- AgingVo agingVo3 = new AgingVo("61-90澶�",new BigDecimal("0"),null);
+ AgingVo agingVo3 = new AgingVo(3L,"61-90澶�",new BigDecimal("0"),null);
companyAgingVo.add(agingVo3);
}
if (!ArrayUtil.contains(overdueRanges.toArray(),"91-180澶�")){
- AgingVo agingVo4 = new AgingVo("91-180澶�",new BigDecimal("0"),null);
+ AgingVo agingVo4 = new AgingVo(4L,"91-180澶�",new BigDecimal("0"),null);
companyAgingVo.add(agingVo4);
}
if (!ArrayUtil.contains(overdueRanges.toArray(),"181-365澶�")){
- AgingVo agingVo5 = new AgingVo("181-365澶�",new BigDecimal("0"),null);
+ AgingVo agingVo5 = new AgingVo(5L,"181-365澶�",new BigDecimal("0"),null);
companyAgingVo.add(agingVo5);
}
if (!ArrayUtil.contains(overdueRanges.toArray(),"1骞翠互涓�")){
- AgingVo agingVo6 = new AgingVo("1骞翠互涓�",new BigDecimal("0"),null);
+ AgingVo agingVo6 = new AgingVo(6L,"1骞翠互涓�",new BigDecimal("0"),null);
companyAgingVo.add(agingVo6);
}
}
+ companyAgingVo.sort(Comparator.comparing(AgingVo::getSort));
agingAnalysisVo.setAmount(companyAgingVo.stream().map(AgingVo::getTotalAmount).collect(Collectors.toList()));
List<AgingVo> finalCompanyAgingVo = companyAgingVo;
agingAnalysisVo.setPercent(IntStream.range(0, agingVoList.size())
@@ -574,12 +597,12 @@
//琛ュ叏鏁版嵁
if (ArrayUtil.isEmpty(companyAgingVo.toArray())){
companyAgingVo = new ArrayList<>();
- AgingVo agingVo1 = new AgingVo("0-30澶�",new BigDecimal("0"),null);
- AgingVo agingVo2 = new AgingVo("31-60澶�",new BigDecimal("0"),null);
- AgingVo agingVo3 = new AgingVo("61-90澶�",new BigDecimal("0"),null);
- AgingVo agingVo4 = new AgingVo("91-180澶�",new BigDecimal("0"),null);
- AgingVo agingVo5 = new AgingVo("181-365澶�",new BigDecimal("0"),null);
- AgingVo agingVo6 = new AgingVo("1骞翠互涓�",new BigDecimal("0"),null);
+ AgingVo agingVo1 = new AgingVo(1L,"0-30澶�",new BigDecimal("0"),null);
+ AgingVo agingVo2 = new AgingVo(2L,"31-60澶�",new BigDecimal("0"),null);
+ AgingVo agingVo3 = new AgingVo(3L,"61-90澶�",new BigDecimal("0"),null);
+ AgingVo agingVo4 = new AgingVo(4L,"91-180澶�",new BigDecimal("0"),null);
+ AgingVo agingVo5 = new AgingVo(5L,"181-365澶�",new BigDecimal("0"),null);
+ AgingVo agingVo6 = new AgingVo(6L,"1骞翠互涓�",new BigDecimal("0"),null);
companyAgingVo.add(agingVo1);
companyAgingVo.add(agingVo2);
companyAgingVo.add(agingVo3);
@@ -589,30 +612,31 @@
}else {
List<String> overdueRanges = companyAgingVo.stream().map(AgingVo::getOverdueRange).collect(Collectors.toList());
if (!ArrayUtil.contains(overdueRanges.toArray(),"0-30澶�")){
- AgingVo agingVo1 = new AgingVo("0-30澶�",new BigDecimal("0"),null);
+ AgingVo agingVo1 = new AgingVo(1L,"0-30澶�",new BigDecimal("0"),null);
companyAgingVo.add(agingVo1);
}
if (!ArrayUtil.contains(overdueRanges.toArray(),"31-60澶�")){
- AgingVo agingVo2 = new AgingVo("31-60澶�",new BigDecimal("0"),null);
+ AgingVo agingVo2 = new AgingVo(2L,"31-60澶�",new BigDecimal("0"),null);
companyAgingVo.add(agingVo2);
}
if (!ArrayUtil.contains(overdueRanges.toArray(),"61-90澶�")){
- AgingVo agingVo3 = new AgingVo("61-90澶�",new BigDecimal("0"),null);
+ AgingVo agingVo3 = new AgingVo(3L,"61-90澶�",new BigDecimal("0"),null);
companyAgingVo.add(agingVo3);
}
if (!ArrayUtil.contains(overdueRanges.toArray(),"91-180澶�")){
- AgingVo agingVo4 = new AgingVo("91-180澶�",new BigDecimal("0"),null);
+ AgingVo agingVo4 = new AgingVo(4L,"91-180澶�",new BigDecimal("0"),null);
companyAgingVo.add(agingVo4);
}
if (!ArrayUtil.contains(overdueRanges.toArray(),"181-365澶�")){
- AgingVo agingVo5 = new AgingVo("181-365澶�",new BigDecimal("0"),null);
+ AgingVo agingVo5 = new AgingVo(5L,"181-365澶�",new BigDecimal("0"),null);
companyAgingVo.add(agingVo5);
}
if (!ArrayUtil.contains(overdueRanges.toArray(),"1骞翠互涓�")){
- AgingVo agingVo6 = new AgingVo("1骞翠互涓�",new BigDecimal("0"),null);
+ AgingVo agingVo6 = new AgingVo(6L,"1骞翠互涓�",new BigDecimal("0"),null);
companyAgingVo.add(agingVo6);
}
}
+ companyAgingVo.sort(Comparator.comparing(AgingVo::getSort));
agingAnalysisVo.setAmount(companyAgingVo.stream().map(AgingVo::getTotalAmount).collect(Collectors.toList()));
List<AgingVo> finalCompanyAgingVo = companyAgingVo;
agingAnalysisVo.setPercent(IntStream.range(0, agingVoList.size())
@@ -670,12 +694,12 @@
//琛ュ叏鏁版嵁
if (ArrayUtil.isEmpty(companyAgingVo.toArray())){
companyAgingVo = new ArrayList<>();
- AgingVo agingVo1 = new AgingVo("0-30澶�",new BigDecimal("0"),null);
- AgingVo agingVo2 = new AgingVo("31-60澶�",new BigDecimal("0"),null);
- AgingVo agingVo3 = new AgingVo("61-90澶�",new BigDecimal("0"),null);
- AgingVo agingVo4 = new AgingVo("91-180澶�",new BigDecimal("0"),null);
- AgingVo agingVo5 = new AgingVo("181-365澶�",new BigDecimal("0"),null);
- AgingVo agingVo6 = new AgingVo("1骞翠互涓�",new BigDecimal("0"),null);
+ AgingVo agingVo1 = new AgingVo(1L,"0-30澶�",new BigDecimal("0"),null);
+ AgingVo agingVo2 = new AgingVo(2L,"31-60澶�",new BigDecimal("0"),null);
+ AgingVo agingVo3 = new AgingVo(3L,"61-90澶�",new BigDecimal("0"),null);
+ AgingVo agingVo4 = new AgingVo(4L,"91-180澶�",new BigDecimal("0"),null);
+ AgingVo agingVo5 = new AgingVo(5L,"181-365澶�",new BigDecimal("0"),null);
+ AgingVo agingVo6 = new AgingVo(6L,"1骞翠互涓�",new BigDecimal("0"),null);
companyAgingVo.add(agingVo1);
companyAgingVo.add(agingVo2);
companyAgingVo.add(agingVo3);
@@ -685,30 +709,31 @@
}else {
List<String> overdueRanges = companyAgingVo.stream().map(AgingVo::getOverdueRange).collect(Collectors.toList());
if (!ArrayUtil.contains(overdueRanges.toArray(),"0-30澶�")){
- AgingVo agingVo1 = new AgingVo("0-30澶�",new BigDecimal("0"),null);
+ AgingVo agingVo1 = new AgingVo(1L,"0-30澶�",new BigDecimal("0"),null);
companyAgingVo.add(agingVo1);
}
if (!ArrayUtil.contains(overdueRanges.toArray(),"31-60澶�")){
- AgingVo agingVo2 = new AgingVo("31-60澶�",new BigDecimal("0"),null);
+ AgingVo agingVo2 = new AgingVo(2L,"31-60澶�",new BigDecimal("0"),null);
companyAgingVo.add(agingVo2);
}
if (!ArrayUtil.contains(overdueRanges.toArray(),"61-90澶�")){
- AgingVo agingVo3 = new AgingVo("61-90澶�",new BigDecimal("0"),null);
+ AgingVo agingVo3 = new AgingVo(3L,"61-90澶�",new BigDecimal("0"),null);
companyAgingVo.add(agingVo3);
}
if (!ArrayUtil.contains(overdueRanges.toArray(),"91-180澶�")){
- AgingVo agingVo4 = new AgingVo("91-180澶�",new BigDecimal("0"),null);
+ AgingVo agingVo4 = new AgingVo(4L,"91-180澶�",new BigDecimal("0"),null);
companyAgingVo.add(agingVo4);
}
if (!ArrayUtil.contains(overdueRanges.toArray(),"181-365澶�")){
- AgingVo agingVo5 = new AgingVo("181-365澶�",new BigDecimal("0"),null);
+ AgingVo agingVo5 = new AgingVo(5L,"181-365澶�",new BigDecimal("0"),null);
companyAgingVo.add(agingVo5);
}
if (!ArrayUtil.contains(overdueRanges.toArray(),"1骞翠互涓�")){
- AgingVo agingVo6 = new AgingVo("1骞翠互涓�",new BigDecimal("0"),null);
+ AgingVo agingVo6 = new AgingVo(6L,"1骞翠互涓�",new BigDecimal("0"),null);
companyAgingVo.add(agingVo6);
}
}
+ companyAgingVo.sort(Comparator.comparing(AgingVo::getSort));
agingAnalysisVo.setAmount(companyAgingVo.stream().map(AgingVo::getTotalAmount).collect(Collectors.toList()));
List<AgingVo> finalCompanyAgingVo = companyAgingVo;
agingAnalysisVo.setPercent(IntStream.range(0, agingVoList.size())
@@ -746,51 +771,6 @@
return R.ok();
}
- private List<AgingVo> completeData(List<AgingVo> companyAgingVo) {
- if (ArrayUtil.isEmpty(companyAgingVo.toArray())) {
- companyAgingVo = new ArrayList<>();
- AgingVo agingVo1 = new AgingVo("0-30澶�", new BigDecimal("0"), null);
- AgingVo agingVo2 = new AgingVo("31-60澶�", new BigDecimal("0"), null);
- AgingVo agingVo3 = new AgingVo("61-90澶�", new BigDecimal("0"), null);
- AgingVo agingVo4 = new AgingVo("91-180澶�", new BigDecimal("0"), null);
- AgingVo agingVo5 = new AgingVo("181-365澶�", new BigDecimal("0"), null);
- AgingVo agingVo6 = new AgingVo("1骞翠互涓�", new BigDecimal("0"), null);
- companyAgingVo.add(agingVo1);
- companyAgingVo.add(agingVo2);
- companyAgingVo.add(agingVo3);
- companyAgingVo.add(agingVo4);
- companyAgingVo.add(agingVo5);
- companyAgingVo.add(agingVo6);
- } else {
- List<String> overdueRanges = companyAgingVo.stream().map(AgingVo::getOverdueRange).collect(Collectors.toList());
- if (!ArrayUtil.contains(overdueRanges.toArray(), "0-30澶�")) {
- AgingVo agingVo1 = new AgingVo("0-30澶�", new BigDecimal("0"), null);
- companyAgingVo.add(agingVo1);
- }
- if (!ArrayUtil.contains(overdueRanges.toArray(), "31-60澶�")) {
- AgingVo agingVo2 = new AgingVo("31-60澶�", new BigDecimal("0"), null);
- companyAgingVo.add(agingVo2);
- }
- if (!ArrayUtil.contains(overdueRanges.toArray(), "61-90澶�")) {
- AgingVo agingVo3 = new AgingVo("61-90澶�", new BigDecimal("0"), null);
- companyAgingVo.add(agingVo3);
- }
- if (!ArrayUtil.contains(overdueRanges.toArray(), "91-180澶�")) {
- AgingVo agingVo4 = new AgingVo("91-180澶�", new BigDecimal("0"), null);
- companyAgingVo.add(agingVo4);
- }
- if (!ArrayUtil.contains(overdueRanges.toArray(), "181-365澶�")) {
- AgingVo agingVo5 = new AgingVo("181-365澶�", new BigDecimal("0"), null);
- companyAgingVo.add(agingVo5);
- }
- if (!ArrayUtil.contains(overdueRanges.toArray(), "1骞翠互涓�")) {
- AgingVo agingVo6 = new AgingVo("1骞翠互涓�", new BigDecimal("0"), null);
- companyAgingVo.add(agingVo6);
- }
- }
- return companyAgingVo;
- }
-
@Override
public R agingAnalysisByMarket(AnalysisCommonDTO commonDTO) {
R<List<SysDictItem>> r = remoteDictService.getDictByType("market_type");
@@ -809,12 +789,12 @@
//琛ュ叏鏁版嵁
if (ArrayUtil.isEmpty(companyAgingVo.toArray())){
companyAgingVo = new ArrayList<>();
- AgingVo agingVo1 = new AgingVo("0-30澶�",new BigDecimal("0"),null);
- AgingVo agingVo2 = new AgingVo("31-60澶�",new BigDecimal("0"),null);
- AgingVo agingVo3 = new AgingVo("61-90澶�",new BigDecimal("0"),null);
- AgingVo agingVo4 = new AgingVo("91-180澶�",new BigDecimal("0"),null);
- AgingVo agingVo5 = new AgingVo("181-365澶�",new BigDecimal("0"),null);
- AgingVo agingVo6 = new AgingVo("1骞翠互涓�",new BigDecimal("0"),null);
+ AgingVo agingVo1 = new AgingVo(1L,"0-30澶�",new BigDecimal("0"),null);
+ AgingVo agingVo2 = new AgingVo(2L,"31-60澶�",new BigDecimal("0"),null);
+ AgingVo agingVo3 = new AgingVo(3L,"61-90澶�",new BigDecimal("0"),null);
+ AgingVo agingVo4 = new AgingVo(4L,"91-180澶�",new BigDecimal("0"),null);
+ AgingVo agingVo5 = new AgingVo(5L,"181-365澶�",new BigDecimal("0"),null);
+ AgingVo agingVo6 = new AgingVo(6L,"1骞翠互涓�",new BigDecimal("0"),null);
companyAgingVo.add(agingVo1);
companyAgingVo.add(agingVo2);
companyAgingVo.add(agingVo3);
@@ -824,30 +804,31 @@
}else {
List<String> overdueRanges = companyAgingVo.stream().map(AgingVo::getOverdueRange).collect(Collectors.toList());
if (!ArrayUtil.contains(overdueRanges.toArray(),"0-30澶�")){
- AgingVo agingVo1 = new AgingVo("0-30澶�",new BigDecimal("0"),null);
+ AgingVo agingVo1 = new AgingVo(1L,"0-30澶�",new BigDecimal("0"),null);
companyAgingVo.add(agingVo1);
}
if (!ArrayUtil.contains(overdueRanges.toArray(),"31-60澶�")){
- AgingVo agingVo2 = new AgingVo("31-60澶�",new BigDecimal("0"),null);
+ AgingVo agingVo2 = new AgingVo(2L,"31-60澶�",new BigDecimal("0"),null);
companyAgingVo.add(agingVo2);
}
if (!ArrayUtil.contains(overdueRanges.toArray(),"61-90澶�")){
- AgingVo agingVo3 = new AgingVo("61-90澶�",new BigDecimal("0"),null);
+ AgingVo agingVo3 = new AgingVo(3L,"61-90澶�",new BigDecimal("0"),null);
companyAgingVo.add(agingVo3);
}
if (!ArrayUtil.contains(overdueRanges.toArray(),"91-180澶�")){
- AgingVo agingVo4 = new AgingVo("91-180澶�",new BigDecimal("0"),null);
+ AgingVo agingVo4 = new AgingVo(4L,"91-180澶�",new BigDecimal("0"),null);
companyAgingVo.add(agingVo4);
}
if (!ArrayUtil.contains(overdueRanges.toArray(),"181-365澶�")){
- AgingVo agingVo5 = new AgingVo("181-365澶�",new BigDecimal("0"),null);
+ AgingVo agingVo5 = new AgingVo(5L,"181-365澶�",new BigDecimal("0"),null);
companyAgingVo.add(agingVo5);
}
if (!ArrayUtil.contains(overdueRanges.toArray(),"1骞翠互涓�")){
- AgingVo agingVo6 = new AgingVo("1骞翠互涓�",new BigDecimal("0"),null);
+ AgingVo agingVo6 = new AgingVo(6L,"1骞翠互涓�",new BigDecimal("0"),null);
companyAgingVo.add(agingVo6);
}
}
+ companyAgingVo.sort(Comparator.comparing(AgingVo::getSort));
agingAnalysisVo.setAmount(companyAgingVo.stream().map(AgingVo::getTotalAmount).collect(Collectors.toList()));
List<AgingVo> finalCompanyAgingVo = companyAgingVo;
agingAnalysisVo.setPercent(IntStream.range(0, agingVoList.size())
@@ -907,12 +888,12 @@
//琛ュ叏鏁版嵁
if (ArrayUtil.isEmpty(companyAgingVo.toArray())){
companyAgingVo = new ArrayList<>();
- AgingVo agingVo1 = new AgingVo("0-30澶�",new BigDecimal("0"),null);
- AgingVo agingVo2 = new AgingVo("31-60澶�",new BigDecimal("0"),null);
- AgingVo agingVo3 = new AgingVo("61-90澶�",new BigDecimal("0"),null);
- AgingVo agingVo4 = new AgingVo("91-180澶�",new BigDecimal("0"),null);
- AgingVo agingVo5 = new AgingVo("181-365澶�",new BigDecimal("0"),null);
- AgingVo agingVo6 = new AgingVo("1骞翠互涓�",new BigDecimal("0"),null);
+ AgingVo agingVo1 = new AgingVo(1L,"0-30澶�",new BigDecimal("0"),null);
+ AgingVo agingVo2 = new AgingVo(2L,"31-60澶�",new BigDecimal("0"),null);
+ AgingVo agingVo3 = new AgingVo(3L,"61-90澶�",new BigDecimal("0"),null);
+ AgingVo agingVo4 = new AgingVo(4L,"91-180澶�",new BigDecimal("0"),null);
+ AgingVo agingVo5 = new AgingVo(5L,"181-365澶�",new BigDecimal("0"),null);
+ AgingVo agingVo6 = new AgingVo(6L,"1骞翠互涓�",new BigDecimal("0"),null);
companyAgingVo.add(agingVo1);
companyAgingVo.add(agingVo2);
companyAgingVo.add(agingVo3);
@@ -922,30 +903,31 @@
}else {
List<String> overdueRanges = companyAgingVo.stream().map(AgingVo::getOverdueRange).collect(Collectors.toList());
if (!ArrayUtil.contains(overdueRanges.toArray(),"0-30澶�")){
- AgingVo agingVo1 = new AgingVo("0-30澶�",new BigDecimal("0"),null);
+ AgingVo agingVo1 = new AgingVo(1L,"0-30澶�",new BigDecimal("0"),null);
companyAgingVo.add(agingVo1);
}
if (!ArrayUtil.contains(overdueRanges.toArray(),"31-60澶�")){
- AgingVo agingVo2 = new AgingVo("31-60澶�",new BigDecimal("0"),null);
+ AgingVo agingVo2 = new AgingVo(2L,"31-60澶�",new BigDecimal("0"),null);
companyAgingVo.add(agingVo2);
}
if (!ArrayUtil.contains(overdueRanges.toArray(),"61-90澶�")){
- AgingVo agingVo3 = new AgingVo("61-90澶�",new BigDecimal("0"),null);
+ AgingVo agingVo3 = new AgingVo(3L,"61-90澶�",new BigDecimal("0"),null);
companyAgingVo.add(agingVo3);
}
if (!ArrayUtil.contains(overdueRanges.toArray(),"91-180澶�")){
- AgingVo agingVo4 = new AgingVo("91-180澶�",new BigDecimal("0"),null);
+ AgingVo agingVo4 = new AgingVo(4L,"91-180澶�",new BigDecimal("0"),null);
companyAgingVo.add(agingVo4);
}
if (!ArrayUtil.contains(overdueRanges.toArray(),"181-365澶�")){
- AgingVo agingVo5 = new AgingVo("181-365澶�",new BigDecimal("0"),null);
+ AgingVo agingVo5 = new AgingVo(5L,"181-365澶�",new BigDecimal("0"),null);
companyAgingVo.add(agingVo5);
}
if (!ArrayUtil.contains(overdueRanges.toArray(),"1骞翠互涓�")){
- AgingVo agingVo6 = new AgingVo("1骞翠互涓�",new BigDecimal("0"),null);
+ AgingVo agingVo6 = new AgingVo(6L,"1骞翠互涓�",new BigDecimal("0"),null);
companyAgingVo.add(agingVo6);
}
}
+ companyAgingVo.sort(Comparator.comparing(AgingVo::getSort));
agingAnalysisVo.setAmount(companyAgingVo.stream().map(AgingVo::getTotalAmount).collect(Collectors.toList()));
List<AgingVo> finalCompanyAgingVo = companyAgingVo;
agingAnalysisVo.setPercent(IntStream.range(0, agingVoList.size())
diff --git a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/utils/NetworkFileToBase64.java b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/utils/NetworkFileToBase64.java
new file mode 100644
index 0000000..2c7e744
--- /dev/null
+++ b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/utils/NetworkFileToBase64.java
@@ -0,0 +1,68 @@
+package com.by4cloud.platformx.business.utils;
+
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.util.Base64;
+
+public class NetworkFileToBase64 {
+
+ /**
+ * 灏嗙綉缁滃湴鍧�鐨勬枃浠惰浆鎹负 Base64 瀛楃涓�
+ *
+ * @param fileUrl 缃戠粶鏂囦欢鐨� URL 鍦板潃
+ * @return Base64 缂栫爜瀛楃涓诧紝澶辫触杩斿洖 null
+ */
+ public static String convertNetworkFileToBase64(String fileUrl) {
+ InputStream inputStream = null;
+ ByteArrayOutputStream outputStream = null;
+
+ try {
+ // 1. 鍒涘缓 URL 瀵硅薄
+ URL url = new URL(fileUrl);
+
+ // 2. 鎵撳紑杩炴帴
+ HttpURLConnection conn = (HttpURLConnection) url.openConnection();
+
+ // 3. 璁剧疆璇锋眰灞炴�у拰瓒呮椂鏃堕棿锛堥槻姝㈤暱鏃堕棿鎸傝捣锛�
+ conn.setRequestMethod("GET");
+ conn.setConnectTimeout(5000); // 杩炴帴瓒呮椂 5绉�
+ conn.setReadTimeout(10000); // 璇诲彇瓒呮椂 10绉�
+
+ // 4. 鑾峰彇杈撳叆娴�
+ int responseCode = conn.getResponseCode();
+ if (responseCode != HttpURLConnection.HTTP_OK) {
+ System.err.println("HTTP 閿欒浠g爜: " + responseCode);
+ return null;
+ }
+
+ inputStream = conn.getInputStream();
+ outputStream = new ByteArrayOutputStream();
+
+ // 5. 璇诲彇鏁版嵁鍒板唴瀛�
+ byte[] buffer = new byte[1024];
+ int len;
+ while ((len = inputStream.read(buffer)) != -1) {
+ outputStream.write(buffer, 0, len);
+ }
+
+ // 6. 鑾峰彇瀛楄妭鏁扮粍骞剁紪鐮�
+ byte[] fileBytes = outputStream.toByteArray();
+ return Base64.getEncoder().encodeToString(fileBytes);
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ return null;
+ } finally {
+ // 7. 鍏抽棴璧勬簮
+ try {
+ if (inputStream != null) inputStream.close();
+ if (outputStream != null) outputStream.close();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+}
diff --git a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/utils/SignHelper.java b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/utils/SignHelper.java
index 0df5a58..02c47aa 100644
--- a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/utils/SignHelper.java
+++ b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/utils/SignHelper.java
@@ -8,6 +8,7 @@
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.util.Base64;
+import java.util.HashMap;
import java.util.Map;
import java.util.TreeMap;
@@ -43,4 +44,13 @@
String base64String = Base64.getEncoder().encodeToString(signData);
return URLEncoder.encode(base64String, "UTF-8");
}
+
+ public static void main(String[] args) throws UnsupportedEncodingException, NoSuchAlgorithmException, InvalidKeyException {
+ long timestamp = System.currentTimeMillis();
+ Map<String, Object> paramMap = new HashMap<>();
+ paramMap.put("appKey", "95578dbdeabc41049b75e8af3dd66d19");
+ paramMap.put("timestamp", timestamp);
+ System.out.println(timestamp);
+ System.out.println(sign(paramMap,"f3a098d7848f87042b39d2cc1645b6c0ffa065cd"));
+ }
}
diff --git a/platformx-business-finance-biz/src/main/resources/mapper/BankStatementMapper.xml b/platformx-business-finance-biz/src/main/resources/mapper/BankStatementMapper.xml
new file mode 100644
index 0000000..7f67546
--- /dev/null
+++ b/platformx-business-finance-biz/src/main/resources/mapper/BankStatementMapper.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+
+<mapper namespace="com.by4cloud.platformx.business.mapper.BankStatementMapper">
+
+ <resultMap id="bankStatementMap" type="com.by4cloud.platformx.business.entity.BankStatement">
+ <id property="id" column="id"/>
+ <result property="compId" column="comp_id"/>
+ <result property="bankSeqNo" column="bank_seq_no"/>
+ <result property="dataId" column="data_id"/>
+ <result property="dataJson" column="data_json"/>
+ <result property="payBankAccName" column="pay_bank_acc_name"/>
+ <result property="payBankNo" column="pay_bank_no"/>
+ <result property="receiveBankAcc" column="receive_bank_acc"/>
+ <result property="receiveBankAccAcc" column="receive_bank_acc_acc"/>
+ <result property="receiveBankAccName" column="receive_bank_acc_name"/>
+ <result property="tranAmount" column="tran_amount"/>
+ <result property="tranDate" column="tran_date"/>
+ <result property="createBy" column="create_by"/>
+ <result property="createTime" column="create_time"/>
+ <result property="updateBy" column="update_by"/>
+ <result property="updateTime" column="update_time"/>
+ <result property="delFlag" column="del_flag"/>
+ </resultMap>
+</mapper>
\ No newline at end of file
diff --git a/platformx-business-finance-biz/src/main/resources/mapper/ContractMapper.xml b/platformx-business-finance-biz/src/main/resources/mapper/ContractMapper.xml
index baaff55..5936e13 100644
--- a/platformx-business-finance-biz/src/main/resources/mapper/ContractMapper.xml
+++ b/platformx-business-finance-biz/src/main/resources/mapper/ContractMapper.xml
@@ -338,6 +338,7 @@
and c.del_flag = '0'
and bc.del_flag = '0'
and bc.area_id = b.area_id
+ AND YEAR( c.sign_date ) = #{queryDTO.year}
and party_b_id IN
<foreach collection="compIds" item="id" open="(" close=")" separator=",">
#{id}
@@ -357,6 +358,7 @@
and c.del_flag = '0'
and bc.del_flag = '0'
and bc.area_id = b.area_id
+ AND YEAR( c.sign_date ) = #{queryDTO.year}
and party_b_id IN
<foreach collection="compIds" item="id" open="(" close=")" separator=",">
#{id}
@@ -376,6 +378,7 @@
and c.del_flag = '0'
and bc.del_flag = '0'
and bc.area_id = b.area_id
+ AND YEAR( c.sign_date ) = #{queryDTO.year}
and party_b_id IN
<foreach collection="compIds" item="id" open="(" close=")" separator=",">
#{id}
@@ -395,6 +398,7 @@
and c.del_flag = '0'
and bc.del_flag = '0'
and bc.area_id = b.area_id
+ AND YEAR( c.sign_date ) = #{queryDTO.year}
and party_b_id IN
<foreach collection="compIds" item="id" open="(" close=")" separator=",">
#{id}
@@ -414,6 +418,7 @@
and c.del_flag = '0'
and bc.del_flag = '0'
and bc.area_id = b.area_id
+ AND YEAR( c.sign_date ) = #{queryDTO.year}
and party_b_id IN
<foreach collection="compIds" item="id" open="(" close=")" separator=",">
#{id}
@@ -425,7 +430,8 @@
contract c
JOIN business_customer b ON c.party_a_id = b.id
WHERE
- b.area_id IS NOT NULL
+ c.del_flag='0'
+ AND b.area_id IS NOT NULL
AND YEAR ( sign_date ) = #{queryDTO.year}
GROUP BY
b.area_id
@@ -445,6 +451,7 @@
where
c1.del_flag = '0'
and c1.industry_code = c.industry_code
+ AND YEAR( sign_date ) = #{queryDTO.year}
and party_b_id IN
<foreach collection="compIds" item="id" open="(" close=")" separator=",">
#{id}
@@ -462,6 +469,7 @@
where
c1.del_flag = '0'
and c1.industry_code = c.industry_code
+ AND YEAR( sign_date ) = #{queryDTO.year}
and party_b_id IN
<foreach collection="compIds" item="id" open="(" close=")" separator=",">
#{id}
@@ -479,6 +487,7 @@
where
c1.del_flag = '0'
and c1.industry_code = c.industry_code
+ AND YEAR( sign_date ) = #{queryDTO.year}
and party_b_id IN
<foreach collection="compIds" item="id" open="(" close=")" separator=",">
#{id}
@@ -496,6 +505,7 @@
where
c1.del_flag = '0'
and c1.industry_code = c.industry_code
+ AND YEAR( sign_date ) = #{queryDTO.year}
and party_b_id IN
<foreach collection="compIds" item="id" open="(" close=")" separator=",">
#{id}
@@ -513,6 +523,7 @@
where
c1.del_flag = '0'
and c1.industry_code = c.industry_code
+ AND YEAR( sign_date ) = #{queryDTO.year}
and party_b_id IN
<foreach collection="compIds" item="id" open="(" close=")" separator=",">
#{id}
@@ -523,7 +534,8 @@
FROM
contract c
where
- c.industry_code is not null
+ c.del_flag='0'
+ AND c.industry_code is not null
AND YEAR ( sign_date ) = #{queryDTO.year}
GROUP BY
c.industry_code
@@ -545,6 +557,7 @@
and c.del_flag = '0'
and bc.del_flag = '0'
and bc.class_id = b.class_id
+ AND YEAR( c.sign_date ) = #{queryDTO.year}
and party_b_id IN
<foreach collection="compIds" item="id" open="(" close=")" separator=",">
#{id}
@@ -564,6 +577,7 @@
and c.del_flag = '0'
and bc.del_flag = '0'
and bc.class_id = b.class_id
+ AND YEAR( c.sign_date ) = #{queryDTO.year}
and party_b_id IN
<foreach collection="compIds" item="id" open="(" close=")" separator=",">
#{id}
@@ -583,6 +597,7 @@
and c.del_flag = '0'
and bc.del_flag = '0'
and bc.class_id = b.class_id
+ AND YEAR( c.sign_date ) = #{queryDTO.year}
and party_b_id IN
<foreach collection="compIds" item="id" open="(" close=")" separator=",">
#{id}
@@ -602,6 +617,7 @@
and c.del_flag = '0'
and bc.del_flag = '0'
and bc.class_id = b.class_id
+ AND YEAR( c.sign_date ) = #{queryDTO.year}
and party_b_id IN
<foreach collection="compIds" item="id" open="(" close=")" separator=",">
#{id}
@@ -621,6 +637,7 @@
and c.del_flag = '0'
and bc.del_flag = '0'
and bc.class_id = b.class_id
+ AND YEAR( c.sign_date ) = #{queryDTO.year}
and party_b_id IN
<foreach collection="compIds" item="id" open="(" close=")" separator=",">
#{id}
@@ -632,7 +649,8 @@
contract c
JOIN business_customer b ON c.party_a_id = b.id
WHERE
- b.class_id IS NOT NULL
+ c.del_flag='0'
+ AND b.class_id IS NOT NULL
AND YEAR ( sign_date ) = #{queryDTO.year}
GROUP BY
b.class_id
@@ -655,6 +673,7 @@
and c.del_flag = '0'
and bc.del_flag = '0'
and bc.export_service_attr = b.export_service_attr
+ AND YEAR( c.sign_date ) = #{queryDTO.year}
and party_b_id IN
<foreach collection="compIds" item="id" open="(" close=")" separator=",">
#{id}
@@ -674,6 +693,7 @@
and c.del_flag = '0'
and bc.del_flag = '0'
and bc.export_service_attr = b.export_service_attr
+ AND YEAR( c.sign_date ) = #{queryDTO.year}
and party_b_id IN
<foreach collection="compIds" item="id" open="(" close=")" separator=",">
#{id}
@@ -693,6 +713,7 @@
and c.del_flag = '0'
and bc.del_flag = '0'
and bc.export_service_attr = b.export_service_attr
+ AND YEAR( c.sign_date ) = #{queryDTO.year}
and party_b_id IN
<foreach collection="compIds" item="id" open="(" close=")" separator=",">
#{id}
@@ -712,6 +733,7 @@
and c.del_flag = '0'
and bc.del_flag = '0'
and bc.export_service_attr = b.export_service_attr
+ AND YEAR( c.sign_date ) = #{queryDTO.year}
and party_b_id IN
<foreach collection="compIds" item="id" open="(" close=")" separator=",">
#{id}
@@ -731,6 +753,7 @@
and c.del_flag = '0'
and bc.del_flag = '0'
and bc.export_service_attr = b.export_service_attr
+ AND YEAR( c.sign_date ) = #{queryDTO.year}
and party_b_id IN
<foreach collection="compIds" item="id" open="(" close=")" separator=",">
#{id}
@@ -742,7 +765,8 @@
contract c
JOIN business_customer b ON c.party_a_id = b.id
WHERE
- b.export_service_attr IS NOT NULL
+ c.del_flag='0'
+ AND b.export_service_attr IS NOT NULL
AND YEAR ( sign_date ) = #{queryDTO.year}
GROUP BY
b.export_service_attr
@@ -762,6 +786,7 @@
WHERE
ct.del_flag = '0'
and ct.supply_attribute = c.supply_attribute
+ AND YEAR ( sign_date ) = #{queryDTO.year}
and ct.party_b_id IN
<foreach collection="compIds" item="id" open="(" close=")" separator=",">
#{id}
@@ -779,6 +804,7 @@
WHERE
ct.del_flag = '0'
and ct.supply_attribute = c.supply_attribute
+ AND YEAR ( sign_date ) = #{queryDTO.year}
and ct.party_b_id IN
<foreach collection="compIds" item="id" open="(" close=")" separator=",">
#{id}
@@ -796,6 +822,7 @@
WHERE
ct.del_flag = '0'
and ct.supply_attribute = c.supply_attribute
+ AND YEAR ( sign_date ) = #{queryDTO.year}
and ct.party_b_id IN
<foreach collection="compIds" item="id" open="(" close=")" separator=",">
#{id}
@@ -813,6 +840,7 @@
WHERE
ct.del_flag = '0'
and ct.supply_attribute = c.supply_attribute
+ AND YEAR ( sign_date ) = #{queryDTO.year}
and ct.party_b_id IN
<foreach collection="compIds" item="id" open="(" close=")" separator=",">
#{id}
@@ -830,6 +858,7 @@
WHERE
ct.del_flag = '0'
and ct.supply_attribute = c.supply_attribute
+ AND YEAR ( sign_date ) = #{queryDTO.year}
and ct.party_b_id IN
<foreach collection="compIds" item="id" open="(" close=")" separator=",">
#{id}
@@ -885,7 +914,9 @@
DATE_FORMAT(sign_date, '%Y-%m') AS stat_month,
SUM(amount) AS total_amount
FROM contract
- WHERE YEAR(sign_date) = #{queryDTO.year}
+ WHERE
+ del_flag='0'
+ AND YEAR(sign_date) = #{queryDTO.year}
AND party_b_id = #{compId}
GROUP BY DATE_FORMAT(sign_date, '%Y-%m')
) curr ON m.stat_month = curr.stat_month
@@ -895,7 +926,8 @@
MONTH(sign_date) AS month_num,
SUM(amount) AS total_amount
FROM contract
- WHERE YEAR(sign_date) = YEAR(CURDATE())
+ WHERE del_flag='0'
+ AND YEAR(sign_date) = YEAR(CURDATE())
AND party_b_id = #{compId}
GROUP BY DATE_FORMAT(sign_date, '%Y-%m'), MONTH(sign_date)
) prev ON m.month_num = prev.month_num + 1
@@ -904,7 +936,8 @@
MONTH(sign_date) AS month_num,
SUM(amount) AS total_amount
FROM contract
- WHERE YEAR(sign_date) = YEAR(CURDATE()) - 1
+ WHERE del_flag='0'
+ AND YEAR(sign_date) = YEAR(CURDATE()) - 1
AND party_b_id = #{compId}
GROUP BY MONTH(sign_date)
) last_year ON m.month_num = last_year.month_num
@@ -927,6 +960,7 @@
and c.del_flag = '0'
and bc.del_flag = '0'
and bc.sales_model = b.sales_model
+ AND YEAR( c.sign_date ) = #{queryDTO.year}
and party_b_id IN
<foreach collection="compIds" item="id" open="(" close=")" separator=",">
#{id}
@@ -946,6 +980,7 @@
and c.del_flag = '0'
and bc.del_flag = '0'
and bc.sales_model = b.sales_model
+ AND YEAR( c.sign_date ) = #{queryDTO.year}
and party_b_id IN
<foreach collection="compIds" item="id" open="(" close=")" separator=",">
#{id}
@@ -965,6 +1000,7 @@
and c.del_flag = '0'
and bc.del_flag = '0'
and bc.sales_model = b.sales_model
+ AND YEAR( c.sign_date ) = #{queryDTO.year}
and party_b_id IN
<foreach collection="compIds" item="id" open="(" close=")" separator=",">
#{id}
@@ -984,6 +1020,7 @@
and c.del_flag = '0'
and bc.del_flag = '0'
and bc.sales_model = b.sales_model
+ AND YEAR( c.sign_date ) = #{queryDTO.year}
and party_b_id IN
<foreach collection="compIds" item="id" open="(" close=")" separator=",">
#{id}
@@ -1003,6 +1040,7 @@
and c.del_flag = '0'
and bc.del_flag = '0'
and bc.sales_model = b.sales_model
+ AND YEAR( c.sign_date ) = #{queryDTO.year}
and party_b_id IN
<foreach collection="compIds" item="id" open="(" close=")" separator=",">
#{id}
@@ -1014,7 +1052,8 @@
contract c
JOIN business_customer b ON c.party_a_id = b.id
WHERE
- b.sales_model IS NOT NULL
+ c.del_flag='0'
+ AND b.sales_model IS NOT NULL
AND YEAR ( sign_date ) = #{queryDTO.year}
GROUP BY
b.sales_model
diff --git a/platformx-business-finance-biz/src/main/resources/mapper/ContractOutBoundMapper.xml b/platformx-business-finance-biz/src/main/resources/mapper/ContractOutBoundMapper.xml
index 113390f..cba7f38 100644
--- a/platformx-business-finance-biz/src/main/resources/mapper/ContractOutBoundMapper.xml
+++ b/platformx-business-finance-biz/src/main/resources/mapper/ContractOutBoundMapper.xml
@@ -450,12 +450,13 @@
AND bc.del_flag = '0'
AND c.del_flag = '0'
AND cob.contract_id = csm.contract_id
+ AND cob.contract_id = c.id
AND bc.id = c.party_a_id
AND bc.area_id = '2'
AND cob.subject_matter_code = csm.material_code
AND cob.comp_id = #{compId}
- <!-- AND cob.out_bound_time >= CURDATE() -->
- AND cob.out_bound_time < DATE_ADD( CURDATE(), INTERVAL -6 DAY )) hbbr,
+ AND cob.out_bound_time >= CURDATE()
+ AND cob.out_bound_time < DATE_ADD(CURDATE(), INTERVAL 1 DAY)) hbbr,
(
SELECT
sum( csm.unit_price * cob.out_bound_num )
@@ -469,6 +470,7 @@
AND bc.del_flag = '0'
AND c.del_flag = '0'
AND cob.contract_id = csm.contract_id
+ AND cob.contract_id = c.id
AND bc.id = c.party_a_id
AND bc.area_id = '2'
AND cob.subject_matter_code = csm.material_code
@@ -488,6 +490,7 @@
AND bc.del_flag = '0'
AND c.del_flag = '0'
AND cob.contract_id = csm.contract_id
+ AND cob.contract_id = c.id
AND bc.id = c.party_a_id
AND bc.area_id = '2'
AND cob.subject_matter_code = csm.material_code
@@ -507,12 +510,13 @@
AND bc.del_flag = '0'
AND c.del_flag = '0'
AND cob.contract_id = csm.contract_id
+ AND cob.contract_id = c.id
AND bc.id = c.party_a_id
AND cob.subject_matter_code = csm.material_code
AND bc.area_id = '6'
AND cob.comp_id = #{compId}
- <!-- AND cob.out_bound_time >= CURDATE() -->
- AND cob.out_bound_time < DATE_ADD( CURDATE(), INTERVAL -6 DAY )) xbbr,
+ AND cob.out_bound_time >= CURDATE()
+ AND cob.out_bound_time < DATE_ADD(CURDATE(), INTERVAL 1 DAY)) xbbr,
(
SELECT
sum( csm.unit_price * cob.out_bound_num )
@@ -526,6 +530,7 @@
AND bc.del_flag = '0'
AND c.del_flag = '0'
AND cob.contract_id = csm.contract_id
+ AND cob.contract_id = c.id
AND bc.id = c.party_a_id
AND cob.subject_matter_code = csm.material_code
AND bc.area_id = '6'
@@ -545,6 +550,7 @@
AND bc.del_flag = '0'
AND c.del_flag = '0'
AND cob.contract_id = csm.contract_id
+ AND cob.contract_id = c.id
AND bc.id = c.party_a_id
AND cob.subject_matter_code = csm.material_code
AND bc.area_id = '6'
@@ -564,12 +570,13 @@
AND bc.del_flag = '0'
AND c.del_flag = '0'
AND cob.contract_id = csm.contract_id
+ AND cob.contract_id = c.id
AND bc.id = c.party_a_id
AND cob.subject_matter_code = csm.material_code
AND bc.area_id = '1'
AND cob.comp_id = #{compId}
- <!-- AND cob.out_bound_time >= CURDATE() -->
- AND cob.out_bound_time < DATE_ADD( CURDATE(), INTERVAL -6 DAY )) dbbr,
+ AND cob.out_bound_time >= CURDATE()
+ AND cob.out_bound_time < DATE_ADD(CURDATE(), INTERVAL 1 DAY)) dbbr,
(
SELECT
sum( csm.unit_price * cob.out_bound_num )
@@ -583,6 +590,7 @@
AND bc.del_flag = '0'
AND c.del_flag = '0'
AND cob.contract_id = csm.contract_id
+ AND cob.contract_id = c.id
AND bc.id = c.party_a_id
AND cob.subject_matter_code = csm.material_code
AND bc.area_id = '1'
@@ -602,6 +610,7 @@
AND bc.del_flag = '0'
AND c.del_flag = '0'
AND cob.contract_id = csm.contract_id
+ AND cob.contract_id = c.id
AND bc.id = c.party_a_id
AND cob.subject_matter_code = csm.material_code
AND bc.area_id = '1'
@@ -621,12 +630,13 @@
AND bc.del_flag = '0'
AND c.del_flag = '0'
AND cob.contract_id = csm.contract_id
+ AND cob.contract_id = c.id
AND bc.id = c.party_a_id
AND cob.subject_matter_code = csm.material_code
AND bc.area_id = '3'
AND cob.comp_id = #{compId}
- <!-- AND cob.out_bound_time >= CURDATE() -->
- AND cob.out_bound_time < DATE_ADD( CURDATE(), INTERVAL -6 DAY )) hdbr,
+ AND cob.out_bound_time >= CURDATE()
+ AND cob.out_bound_time < DATE_ADD(CURDATE(), INTERVAL 1 DAY)) hdbr,
(
SELECT
sum( csm.unit_price * cob.out_bound_num )
@@ -640,6 +650,7 @@
AND bc.del_flag = '0'
AND c.del_flag = '0'
AND cob.contract_id = csm.contract_id
+ AND cob.contract_id = c.id
AND bc.id = c.party_a_id
AND cob.subject_matter_code = csm.material_code
AND bc.area_id = '3'
@@ -659,6 +670,7 @@
AND bc.del_flag = '0'
AND c.del_flag = '0'
AND cob.contract_id = csm.contract_id
+ AND cob.contract_id = c.id
AND bc.id = c.party_a_id
AND cob.subject_matter_code = csm.material_code
AND bc.area_id = '3'
@@ -678,12 +690,13 @@
AND bc.del_flag = '0'
AND c.del_flag = '0'
AND cob.contract_id = csm.contract_id
+ AND cob.contract_id = c.id
AND bc.id = c.party_a_id
AND cob.subject_matter_code = csm.material_code
AND bc.area_id = '4'
AND cob.comp_id = #{compId}
- <!-- AND cob.out_bound_time >= CURDATE() -->
- AND cob.out_bound_time < DATE_ADD( CURDATE(), INTERVAL -6 DAY )) znbr,
+ AND cob.out_bound_time >= CURDATE()
+ AND cob.out_bound_time < DATE_ADD(CURDATE(), INTERVAL 1 DAY)) znbr,
(
SELECT
sum( csm.unit_price * cob.out_bound_num )
@@ -697,6 +710,7 @@
AND bc.del_flag = '0'
AND c.del_flag = '0'
AND cob.contract_id = csm.contract_id
+ AND cob.contract_id = c.id
AND bc.id = c.party_a_id
AND cob.subject_matter_code = csm.material_code
AND bc.area_id = '4'
@@ -716,6 +730,7 @@
AND bc.del_flag = '0'
AND c.del_flag = '0'
AND cob.contract_id = csm.contract_id
+ AND cob.contract_id = c.id
AND bc.id = c.party_a_id
AND cob.subject_matter_code = csm.material_code
AND bc.area_id = '4'
@@ -735,12 +750,13 @@
AND bc.del_flag = '0'
AND c.del_flag = '0'
AND cob.contract_id = csm.contract_id
+ AND cob.contract_id = c.id
AND bc.id = c.party_a_id
AND cob.subject_matter_code = csm.material_code
AND bc.area_id = '5'
AND cob.comp_id = #{compId}
- <!-- AND cob.out_bound_time >= CURDATE() -->
- AND cob.out_bound_time < DATE_ADD( CURDATE(), INTERVAL -6 DAY )) xnbr,
+ AND cob.out_bound_time >= CURDATE()
+ AND cob.out_bound_time < DATE_ADD(CURDATE(), INTERVAL 1 DAY)) xnbr,
(
SELECT
sum( csm.unit_price * cob.out_bound_num )
@@ -754,6 +770,7 @@
AND bc.del_flag = '0'
AND c.del_flag = '0'
AND cob.contract_id = csm.contract_id
+ AND cob.contract_id = c.id
AND bc.id = c.party_a_id
AND cob.subject_matter_code = csm.material_code
AND bc.area_id = '5'
@@ -773,6 +790,7 @@
AND bc.del_flag = '0'
AND c.del_flag = '0'
AND cob.contract_id = csm.contract_id
+ AND cob.contract_id = c.id
AND bc.id = c.party_a_id
AND cob.subject_matter_code = csm.material_code
AND bc.area_id = '5'
@@ -792,12 +810,13 @@
AND bc.del_flag = '0'
AND c.del_flag = '0'
AND cob.contract_id = csm.contract_id
+ AND cob.contract_id = c.id
AND bc.id = c.party_a_id
AND cob.subject_matter_code = csm.material_code
AND bc.export_service_attr = '2'
AND cob.comp_id = #{compId}
- <!-- AND cob.out_bound_time >= CURDATE() -->
- AND cob.out_bound_time < DATE_ADD( CURDATE(), INTERVAL -6 DAY )) hwbr,
+ AND cob.out_bound_time >= CURDATE()
+ AND cob.out_bound_time < DATE_ADD(CURDATE(), INTERVAL 1 DAY)) hwbr,
(
SELECT
sum( csm.unit_price * cob.out_bound_num )
@@ -811,6 +830,7 @@
AND bc.del_flag = '0'
AND c.del_flag = '0'
AND cob.contract_id = csm.contract_id
+ AND cob.contract_id = c.id
AND bc.id = c.party_a_id
AND cob.subject_matter_code = csm.material_code
AND bc.export_service_attr = '2'
@@ -830,6 +850,7 @@
AND bc.del_flag = '0'
AND c.del_flag = '0'
AND cob.contract_id = csm.contract_id
+ AND cob.contract_id = c.id
AND bc.id = c.party_a_id
AND cob.subject_matter_code = csm.material_code
AND bc.export_service_attr = '2'
@@ -852,12 +873,13 @@
AND bc.del_flag = '0'
AND c.del_flag = '0'
AND cob.contract_id = csm.contract_id
+ AND cob.contract_id = c.id
AND bc.id = c.party_a_id
AND bc.area_id = '2'
AND cob.subject_matter_code = csm.material_code
AND cob.comp_id = #{compId}
- <!-- AND cob.out_bound_time >= CURDATE() -->
- AND cob.out_bound_time < DATE_ADD( CURDATE(), INTERVAL -6 DAY )) hbbr,
+ AND cob.out_bound_time >= CURDATE()
+ AND cob.out_bound_time < DATE_ADD(CURDATE(), INTERVAL 1 DAY)) hbbr,
(
SELECT
sum( csm.unit_price * ( cob.out_bound_num - cob.invoice_num ) )
@@ -871,6 +893,7 @@
AND bc.del_flag = '0'
AND c.del_flag = '0'
AND cob.contract_id = csm.contract_id
+ AND cob.contract_id = c.id
AND bc.id = c.party_a_id
AND bc.area_id = '2'
AND cob.subject_matter_code = csm.material_code
@@ -890,6 +913,7 @@
AND bc.del_flag = '0'
AND c.del_flag = '0'
AND cob.contract_id = csm.contract_id
+ AND cob.contract_id = c.id
AND bc.id = c.party_a_id
AND bc.area_id = '2'
AND cob.subject_matter_code = csm.material_code
@@ -909,13 +933,14 @@
AND bc.del_flag = '0'
AND c.del_flag = '0'
AND cob.contract_id = csm.contract_id
+ AND cob.contract_id = c.id
AND bc.id = c.party_a_id
AND cob.subject_matter_code = csm.material_code
AND bc.area_id = '6'
AND cob.comp_id = #{compId}
- <!-- AND cob.out_bound_time >= CURDATE() -->
- AND cob.out_bound_time < DATE_ADD( CURDATE(), INTERVAL -6 DAY )) xbbr,
- (
+ AND cob.out_bound_time >= CURDATE()
+ AND cob.out_bound_time < DATE_ADD(CURDATE(), INTERVAL 1 DAY)) xbbr,
+ (
SELECT
sum( csm.unit_price * ( cob.out_bound_num - cob.invoice_num ) )
FROM
@@ -928,6 +953,7 @@
AND bc.del_flag = '0'
AND c.del_flag = '0'
AND cob.contract_id = csm.contract_id
+ AND cob.contract_id = c.id
AND bc.id = c.party_a_id
AND cob.subject_matter_code = csm.material_code
AND bc.area_id = '6'
@@ -947,6 +973,7 @@
AND bc.del_flag = '0'
AND c.del_flag = '0'
AND cob.contract_id = csm.contract_id
+ AND cob.contract_id = c.id
AND bc.id = c.party_a_id
AND cob.subject_matter_code = csm.material_code
AND bc.area_id = '6'
@@ -966,12 +993,13 @@
AND bc.del_flag = '0'
AND c.del_flag = '0'
AND cob.contract_id = csm.contract_id
+ AND cob.contract_id = c.id
AND bc.id = c.party_a_id
AND cob.subject_matter_code = csm.material_code
AND bc.area_id = '1'
AND cob.comp_id = #{compId}
- <!-- AND cob.out_bound_time >= CURDATE() -->
- AND cob.out_bound_time < DATE_ADD( CURDATE(), INTERVAL -6 DAY )) dbbr,
+ AND cob.out_bound_time >= CURDATE()
+ AND cob.out_bound_time < DATE_ADD(CURDATE(), INTERVAL 1 DAY)) dbbr,
(
SELECT
sum( csm.unit_price * ( cob.out_bound_num - cob.invoice_num ) )
@@ -985,6 +1013,7 @@
AND bc.del_flag = '0'
AND c.del_flag = '0'
AND cob.contract_id = csm.contract_id
+ AND cob.contract_id = c.id
AND bc.id = c.party_a_id
AND cob.subject_matter_code = csm.material_code
AND bc.area_id = '1'
@@ -1004,6 +1033,7 @@
AND bc.del_flag = '0'
AND c.del_flag = '0'
AND cob.contract_id = csm.contract_id
+ AND cob.contract_id = c.id
AND bc.id = c.party_a_id
AND cob.subject_matter_code = csm.material_code
AND bc.area_id = '1'
@@ -1023,12 +1053,13 @@
AND bc.del_flag = '0'
AND c.del_flag = '0'
AND cob.contract_id = csm.contract_id
+ AND cob.contract_id = c.id
AND bc.id = c.party_a_id
AND cob.subject_matter_code = csm.material_code
AND bc.area_id = '3'
AND cob.comp_id = #{compId}
- <!-- AND cob.out_bound_time >= CURDATE() -->
- AND cob.out_bound_time < DATE_ADD( CURDATE(), INTERVAL -6 DAY )) hdbr,
+ AND cob.out_bound_time >= CURDATE()
+ AND cob.out_bound_time < DATE_ADD(CURDATE(), INTERVAL 1 DAY)) hdbr,
(
SELECT
sum( csm.unit_price * ( cob.out_bound_num - cob.invoice_num ) )
@@ -1042,6 +1073,7 @@
AND bc.del_flag = '0'
AND c.del_flag = '0'
AND cob.contract_id = csm.contract_id
+ AND cob.contract_id = c.id
AND bc.id = c.party_a_id
AND cob.subject_matter_code = csm.material_code
AND bc.area_id = '3'
@@ -1061,6 +1093,7 @@
AND bc.del_flag = '0'
AND c.del_flag = '0'
AND cob.contract_id = csm.contract_id
+ AND cob.contract_id = c.id
AND bc.id = c.party_a_id
AND cob.subject_matter_code = csm.material_code
AND bc.area_id = '3'
@@ -1080,12 +1113,13 @@
AND bc.del_flag = '0'
AND c.del_flag = '0'
AND cob.contract_id = csm.contract_id
+ AND cob.contract_id = c.id
AND bc.id = c.party_a_id
AND cob.subject_matter_code = csm.material_code
AND bc.area_id = '4'
AND cob.comp_id = #{compId}
- <!-- AND cob.out_bound_time >= CURDATE() -->
- AND cob.out_bound_time < DATE_ADD( CURDATE(), INTERVAL -6 DAY )) znbr,
+ AND cob.out_bound_time >= CURDATE()
+ AND cob.out_bound_time < DATE_ADD(CURDATE(), INTERVAL 1 DAY)) znbr,
(
SELECT
sum( csm.unit_price * ( cob.out_bound_num - cob.invoice_num ) )
@@ -1099,6 +1133,7 @@
AND bc.del_flag = '0'
AND c.del_flag = '0'
AND cob.contract_id = csm.contract_id
+ AND cob.contract_id = c.id
AND bc.id = c.party_a_id
AND cob.subject_matter_code = csm.material_code
AND bc.area_id = '4'
@@ -1118,6 +1153,7 @@
AND bc.del_flag = '0'
AND c.del_flag = '0'
AND cob.contract_id = csm.contract_id
+ AND cob.contract_id = c.id
AND bc.id = c.party_a_id
AND cob.subject_matter_code = csm.material_code
AND bc.area_id = '4'
@@ -1137,12 +1173,13 @@
AND bc.del_flag = '0'
AND c.del_flag = '0'
AND cob.contract_id = csm.contract_id
+ AND cob.contract_id = c.id
AND bc.id = c.party_a_id
AND cob.subject_matter_code = csm.material_code
AND bc.area_id = '5'
AND cob.comp_id = #{compId}
- <!-- AND cob.out_bound_time >= CURDATE() -->
- AND cob.out_bound_time < DATE_ADD( CURDATE(), INTERVAL -6 DAY )) xnbr,
+ AND cob.out_bound_time >= CURDATE()
+ AND cob.out_bound_time < DATE_ADD(CURDATE(), INTERVAL 1 DAY)) xnbr,
(
SELECT
sum( csm.unit_price * ( cob.out_bound_num - cob.invoice_num ) )
@@ -1156,6 +1193,7 @@
AND bc.del_flag = '0'
AND c.del_flag = '0'
AND cob.contract_id = csm.contract_id
+ AND cob.contract_id = c.id
AND bc.id = c.party_a_id
AND cob.subject_matter_code = csm.material_code
AND bc.area_id = '5'
@@ -1175,6 +1213,7 @@
AND bc.del_flag = '0'
AND c.del_flag = '0'
AND cob.contract_id = csm.contract_id
+ AND cob.contract_id = c.id
AND bc.id = c.party_a_id
AND cob.subject_matter_code = csm.material_code
AND bc.area_id = '5'
@@ -1194,12 +1233,13 @@
AND bc.del_flag = '0'
AND c.del_flag = '0'
AND cob.contract_id = csm.contract_id
+ AND cob.contract_id = c.id
AND bc.id = c.party_a_id
AND cob.subject_matter_code = csm.material_code
AND bc.export_service_attr = '2'
AND cob.comp_id = #{compId}
- <!-- AND cob.out_bound_time >= CURDATE() -->
- AND cob.out_bound_time < DATE_ADD( CURDATE(), INTERVAL -6 DAY )) hwbr,
+ AND cob.out_bound_time >= CURDATE()
+ AND cob.out_bound_time < DATE_ADD(CURDATE(), INTERVAL 1 DAY)) hwbr,
(
SELECT
sum( csm.unit_price * ( cob.out_bound_num - cob.invoice_num ) )
@@ -1232,6 +1272,7 @@
AND bc.del_flag = '0'
AND c.del_flag = '0'
AND cob.contract_id = csm.contract_id
+ AND cob.contract_id = c.id
AND bc.id = c.party_a_id
AND cob.subject_matter_code = csm.material_code
AND bc.export_service_attr = '2'
diff --git a/platformx-business-finance-biz/src/main/resources/mapper/ContractPaymentScheduleMapper.xml b/platformx-business-finance-biz/src/main/resources/mapper/ContractPaymentScheduleMapper.xml
index 8f0d3dc..3cd1104 100644
--- a/platformx-business-finance-biz/src/main/resources/mapper/ContractPaymentScheduleMapper.xml
+++ b/platformx-business-finance-biz/src/main/resources/mapper/ContractPaymentScheduleMapper.xml
@@ -50,38 +50,64 @@
</select>
<select id="selectAgingTotal" resultType="com.by4cloud.platformx.business.vo.AgingVo">
SELECT
+ ranges.sort,
ranges.overdue_range,
- COALESCE(SUM(
+ COALESCE (
+ sum(
CASE
+
WHEN cps.payment_status = '0' THEN
cps.planned_amount
WHEN cps.payment_status = '1' THEN
cps.planned_amount - cps.actual_amount ELSE 0
END
- ), 0) AS total_amount
+ ),
+ 0
+ ) AS total_amount
FROM
(
- SELECT '0-30澶�' AS overdue_range, 0 AS min_days, 30 AS max_days UNION ALL
- SELECT '31-60澶�', 31, 60 UNION ALL
- SELECT '61-90澶�', 61, 90 UNION ALL
- SELECT '91-180澶�', 91, 180 UNION ALL
- SELECT '181-365澶�', 181, 365 UNION ALL
- SELECT '1骞翠互涓�', 366, 999999
- ) AS ranges
- LEFT JOIN
- contract_payment_schedule cps ON
- cps.del_flag = '0'
- AND cps.payment_status NOT IN ('2', '3')
- AND cps.effective_end_date < current_date
- AND DATEDIFF(current_date, cps.effective_end_date) BETWEEN ranges.min_days AND ranges.max_days
- LEFT JOIN
- contract c ON cps.contract_id = c.id
- LEFT JOIN
- business_customer bc ON c.party_a_id = bc.id
- where
- c.del_flag = '0'
+ SELECT
+ 1 sort,
+ '0-30澶�' AS overdue_range,
+ 0 AS min_days,
+ 30 AS max_days UNION ALL
+ SELECT
+ 2 sort,
+ '31-60澶�',
+ 31,
+ 60 UNION ALL
+ SELECT
+ 3 sort,
+ '61-90澶�',
+ 61,
+ 90 UNION ALL
+ SELECT
+ 4 sort,
+ '91-180澶�',
+ 91,
+ 180 UNION ALL
+ SELECT
+ 5 sort,
+ '181-365澶�',
+ 181,
+ 365 UNION ALL
+ SELECT
+ 6 sort,
+ '1骞翠互涓�',
+ 366,
+ 999999
+ ) ranges
+ LEFT JOIN contract_payment_schedule cps ON cps.del_flag = '0'
+ AND cps.payment_status NOT IN ( '2', '3' )
+ AND cps.effective_end_date < CURRENT_DATE
+ AND DATEDIFF( CURRENT_DATE, cps.effective_end_date ) BETWEEN ranges.min_days
+ AND ranges.max_days
+ LEFT JOIN contract c ON cps.contract_id = c.id
+ LEFT JOIN business_customer bc ON c.party_a_id = bc.id
+ WHERE
+ c.del_flag = '0'
<if test="queryDTO.companyId !=null">
- and c.party_a_id = #{queryDTO.companyId}
+ and c.comp_id = #{queryDTO.companyId}
</if>
<if test="queryDTO.areaId !=null">
and bc.area_id = #{queryDTO.areaId}
@@ -93,10 +119,11 @@
and bc.class_id = #{queryDTO.classId}
</if>
GROUP BY
+ ranges.sort,
ranges.overdue_range,
ranges.min_days
ORDER BY
- ranges.min_days;
+ ranges.min_days
</select>
<select id="selectAgingCompanyShip" resultType="com.by4cloud.platformx.business.vo.AgingCompanyVo">
SELECT
@@ -128,6 +155,7 @@
</select>
<select id="selectAgingTotalShip" resultType="com.by4cloud.platformx.business.vo.AgingVo">
SELECT
+ ranges.sort,
ranges.overdue_range,
COALESCE (
sum(amount-paid_amount),
@@ -135,31 +163,37 @@
) AS total_amount
FROM
(
- SELECT
- '0-30澶�' AS overdue_range,
- 0 AS min_days,
- 30 AS max_days UNION ALL
- SELECT
- '31-60澶�',
- 31,
- 60 UNION ALL
- SELECT
- '61-90澶�',
- 61,
- 90 UNION ALL
- SELECT
- '91-180澶�',
- 91,
- 180 UNION ALL
- SELECT
- '181-365澶�',
- 181,
- 365 UNION ALL
- SELECT
- '1骞翠互涓�',
- 366,
- 999999
- ) ranges
+ SELECT
+ 1 sort,
+ '0-30澶�' AS overdue_range,
+ 0 AS min_days,
+ 30 AS max_days UNION ALL
+ SELECT
+ 2 sort,
+ '31-60澶�',
+ 31,
+ 60 UNION ALL
+ SELECT
+ 3 sort,
+ '61-90澶�',
+ 61,
+ 90 UNION ALL
+ SELECT
+ 4 sort,
+ '91-180澶�',
+ 91,
+ 180 UNION ALL
+ SELECT
+ 5 sort,
+ '181-365澶�',
+ 181,
+ 365 UNION ALL
+ SELECT
+ 6 sort,
+ '1骞翠互涓�',
+ 366,
+ 999999
+ ) ranges
LEFT JOIN contract c ON c.del_flag = '0'
AND DATEDIFF(
CURRENT_DATE,
@@ -173,6 +207,7 @@
</if>
AND EXISTS ( SELECT 1 FROM contract_out_bound cob WHERE cob.del_flag = '0' AND cob.contract_id = c.id )
GROUP BY
+ ranges.sort,
ranges.overdue_range,
ranges.min_days
ORDER BY
@@ -180,6 +215,7 @@
</select>
<select id="selectAgingTotalInvoice" resultType="com.by4cloud.platformx.business.vo.AgingVo">
SELECT
+ ranges.sort,
ranges.overdue_range,
COALESCE (
sum(amount-paid_amount),
@@ -187,31 +223,37 @@
) AS total_amount
FROM
(
- SELECT
- '0-30澶�' AS overdue_range,
- 0 AS min_days,
- 30 AS max_days UNION ALL
- SELECT
- '31-60澶�',
- 31,
- 60 UNION ALL
- SELECT
- '61-90澶�',
- 61,
- 90 UNION ALL
- SELECT
- '91-180澶�',
- 91,
- 180 UNION ALL
- SELECT
- '181-365澶�',
- 181,
- 365 UNION ALL
- SELECT
- '1骞翠互涓�',
- 366,
- 999999
- ) ranges
+ SELECT
+ 1 sort,
+ '0-30澶�' AS overdue_range,
+ 0 AS min_days,
+ 30 AS max_days UNION ALL
+ SELECT
+ 2 sort,
+ '31-60澶�',
+ 31,
+ 60 UNION ALL
+ SELECT
+ 3 sort,
+ '61-90澶�',
+ 61,
+ 90 UNION ALL
+ SELECT
+ 4 sort,
+ '91-180澶�',
+ 91,
+ 180 UNION ALL
+ SELECT
+ 5 sort,
+ '181-365澶�',
+ 181,
+ 365 UNION ALL
+ SELECT
+ 6 sort,
+ '1骞翠互涓�',
+ 366,
+ 999999
+ ) ranges
LEFT JOIN contract c ON c.del_flag = '0'
AND DATEDIFF(
CURRENT_DATE,
@@ -225,6 +267,7 @@
</if>
AND EXISTS ( SELECT 1 FROM contract_invoice ci WHERE ci.del_flag = '0' AND ci.contract_id = c.id)
GROUP BY
+ ranges.sort,
ranges.overdue_range,
ranges.min_days
ORDER BY
@@ -232,6 +275,7 @@
</select>
<select id="selectAgingTotalScale" resultType="com.by4cloud.platformx.business.vo.AgingVo">
SELECT
+ ranges.sort,
ranges.overdue_range,
COALESCE (
SUM(
@@ -248,26 +292,32 @@
FROM
(
SELECT
+ 1 sort,
'0-30澶�' AS overdue_range,
0 AS min_days,
30 AS max_days UNION ALL
SELECT
+ 2 sort,
'31-60澶�',
31,
60 UNION ALL
SELECT
+ 3 sort,
'61-90澶�',
61,
90 UNION ALL
SELECT
+ 4 sort,
'91-180澶�',
91,
180 UNION ALL
SELECT
+ 5 sort,
'181-365澶�',
181,
365 UNION ALL
SELECT
+ 6 sort,
'1骞翠互涓�',
366,
999999
@@ -284,6 +334,7 @@
and c.party_b_id = #{queryDTO.companyId}
</if>
GROUP BY
+ ranges.sort,
ranges.overdue_range,
ranges.min_days
ORDER BY
diff --git a/platformx-business-finance-biz/src/main/resources/mapper/DeliveryOverdueMapper.xml b/platformx-business-finance-biz/src/main/resources/mapper/DeliveryOverdueMapper.xml
index 9798fe4..5240901 100644
--- a/platformx-business-finance-biz/src/main/resources/mapper/DeliveryOverdueMapper.xml
+++ b/platformx-business-finance-biz/src/main/resources/mapper/DeliveryOverdueMapper.xml
@@ -27,6 +27,7 @@
t.id,
t.bus_guest_name,
t.bus_guest_id,
+ t1.contract_no,
t.contract_name,
t.contract_id,
t.material_name,
diff --git a/platformx-business-finance-biz/src/main/resources/mapper/ProductMapper.xml b/platformx-business-finance-biz/src/main/resources/mapper/ProductMapper.xml
index 9fb6ef8..e9319cd 100644
--- a/platformx-business-finance-biz/src/main/resources/mapper/ProductMapper.xml
+++ b/platformx-business-finance-biz/src/main/resources/mapper/ProductMapper.xml
@@ -71,11 +71,20 @@
<if test="queryDTO.parentId !=null ">
and t.parent_id = #{queryDTO.parentId}
</if>
- <if test="queryDTO.contractCategory !=null and queryDTO.contractCategory !='' and queryDTO.contractCategory=='water_house'">
- and t.erp_code in
- <foreach collection="erpCodes" item="erp" open="(" separator="," close=")">
- #{erp}
- </foreach>
- </if>
+ <choose>
+ <when test="queryDTO.contractCategory !=null and queryDTO.contractCategory !='' and queryDTO.contractCategory=='water_house'">
+ and t.erp_code in
+ <foreach collection="erpCodes" item="erp" open="(" separator="," close=")">
+ #{erp}
+ </foreach>
+ </when>
+ <otherwise>
+ and t.erp_code not in
+ <foreach collection="erpCodes" item="erp" open="(" separator="," close=")">
+ #{erp}
+ </foreach>
+ </otherwise>
+ </choose>
+
</select>
</mapper>
\ No newline at end of file
--
Gitblit v1.9.1