From e02812df9217d3e50a368a8234c07c60c64c0ff4 Mon Sep 17 00:00:00 2001
From: shiyunteng <shiyunteng@example.com>
Date: 星期三, 05 八月 2026 08:34:26 +0800
Subject: [PATCH] feat:新增石煤机 机械厂模版合同/客户数据主数据同步接口/合同履约进度新增质保结束操作/合同开票状态 修改为待开 可开 已开/出库逻辑完善
---
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/controller/BusinessCustomerController.java | 15
platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/entity/Contract.java | 153 ++
platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/entity/MeterReadRecord.java | 18
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/mapper/BipViewMapper.java | 8
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/PaymentSlipServiceImpl.java | 2
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/controller/ContractInvoiceController.java | 42
platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/dto/ContractSubjectMatterAddDTO.java | 3
platformx-business-finance-biz/src/main/resources/mapper/DeliveryOverdueMapper.xml | 2
platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/FourAssociationPageVo.java | 31
platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/BusinessCustomerMainVo.java | 22
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/mapper/ContractMapper.java | 4
platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/InvoiceItemVo.java | 3
platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/entity/ContractSubjectMatter.java | 14
platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/ContractInvoiceVo.java | 16
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/OutBoundService.java | 2
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/OutBoundServiceImpl.java | 289 +++-
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/PaymentOffsetServiceImpl.java | 2
platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/dto/ContractAddDTO.java | 87 +
platformx-business-finance-biz/src/main/resources/mapper/ContractPaymentScheduleMapper.xml | 8
platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/ContractCreditSalesPageVo.java | 3
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/ContractInvoiceServiceImpl.java | 401 +++++-
platformx-boot/src/main/resources/application-dev.yml | 1
platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/ContractInvoiceOutBoundVo.java | 6
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/MeterReadRecordServiceImpl.java | 70 +
platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/ContractInvoicePageVo.java | 92 +
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/ContractService.java | 9
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/controller/PaymentConfirmController.java | 8
platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/entity/PaymentSlip.java | 3
platformx-business-finance-biz/src/main/resources/template/jxc/product.xlsx | 0
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/mapper/BipBanklViewMapper.java | 4
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/ContractInvoiceService.java | 5
platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/dto/OutBoundAddDTO.java | 3
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/StatisticServiceImpl.java | 161 ++
platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/ContractSlipVo.java | 16
platformx-business-finance-biz/src/main/resources/mapper/ContractMapper.xml | 79
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/ContractPaymentScheduleProcessServiceImpl.java | 128 +
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/BusinessCustomerServiceImpl.java | 57
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/controller/ContractController.java | 66 +
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/controller/OutBoundController.java | 12
platformx-business-finance-biz/src/main/resources/template/smj/smjgypmmht.docx | 0
platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/entity/OutBound.java | 4
platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/ContractHouseWaterVo.java | 27
platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/dto/GenInvoiceInfoDTO.java | 2
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/controller/PaymentSlipController.java | 9
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/ContractServiceImpl.java | 661 +++++++++--
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/PaymentConfirmServiceImpl.java | 624 +++++-----
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/mapper/ContractInvoiceMapper.java | 4
platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/ContractOutBoundInvoiceVo.java | 2
platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/entity/ContractPaymentSchedule.java | 12
platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/ContractOutBoundMergeVo.java | 3
platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/ContractDetailVo.java | 96 +
platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/dto/ContractQueryDTO.java | 2
platformx-business-finance-biz/src/main/resources/template/ymj/ymjgypmmht.docx | 0
platformx-business-finance-biz/src/main/resources/mapper/ContractInvoiceMapper.xml | 87 +
platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/ContractPageVo.java | 5
platformx-business-finance-biz/src/main/resources/template/jxc/jxcxsht.docx | 0
platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/dto/OutSubjectMatterAddDTO.java | 3
platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/CustInfoVo.java | 2
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/BusinessCustomerService.java | 6
platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/PaymentSlipService.java | 2
platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/GenInvoiceInfoVo.java | 3
platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/entity/ContractOutBound.java | 4
62 files changed, 2,531 insertions(+), 872 deletions(-)
diff --git a/platformx-boot/src/main/resources/application-dev.yml b/platformx-boot/src/main/resources/application-dev.yml
index 3b2897a..8418c31 100644
--- a/platformx-boot/src/main/resources/application-dev.yml
+++ b/platformx-boot/src/main/resources/application-dev.yml
@@ -73,7 +73,6 @@
#erp鎺ㄩ��
erp:
ymj:
- ymjToken:
smj:
sgb:
jxc:
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 3e6e108..28bae44 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
@@ -15,6 +15,8 @@
@Data
public class ContractAddDTO {
+ private String dataId;
+
@Schema(description = "鍚堝悓缂栧彿")
private String contractNo;
@@ -158,6 +160,91 @@
@Schema(description = "瀹㈡埛erp缂栫爜")
private String partyACode;
+ @Column(columnDefinition = "VARCHAR(50) comment '琛屼笟'")
+ private String industryCode;
+
+ @Column(columnDefinition = "VARCHAR(50) comment '鍖哄煙'")
+ private String areaCode;
+
+ @Schema(description = "闇�鏂瑰湪鎺ュ埌閫氱煡鍚� 鏃ュ唴杩涜妫�楠�")
+ private BigDecimal inspectDay;
+
+ @Schema(description = "鏀跺埌渚涙柟閫氱煡鍚� 鏃ュ唴娲句汉楠屾敹")
+ private BigDecimal acceptDay;
+
+ @Schema(description = "寤堕獙鏀惰秴杩� 鏃�")
+ private BigDecimal delayAcceptDay;
+
+ @Schema(description = "楠屾敹鍚堟牸鍚� 涓伐浣滄棩")
+ private BigDecimal acceptPassDay;
+
+ @Schema(description = "楠屾敹鍚堟牸鍚戜緵鏂硅冻棰濇敮浠樺悎鍚屾�讳环鐨�")
+ private BigDecimal acceptPassAmount;
+
+ @Schema(description = "鏃ュ唴寮�濮嬪彂璐�")
+ private BigDecimal deliverDay;
+
+ @Schema(description = "鏃ュ唴鍙戝畬")
+ private BigDecimal deliverCompleteDay;
+
+ @Schema(description = "渚涙柟浠g悊")
+ private String supplierAgent;
+
+ @Schema(description = "渚涙柟浠g悊韬唤璇�")
+ private String supplierAgentIdCard;
+
+ @Schema(description = "闇�鏂逛唬鐞�")
+ private String buyerAgent;
+
+ @Schema(description = "闇�鏂逛唬鐞嗚韩浠借瘉")
+ private String buyerAgentIdCard;
+
+ private String agentAuthority;
+
+ @Schema(description = "寤舵湡鏀粯棰勪粯娆�")
+ private BigDecimal delayPayAdvancePayment;
+
+ @Schema(description = "寤舵湡鏀粯杩涘害娆�")
+ private BigDecimal delayPayProcessPayment;
+
+ @Schema(description = "鏀跺埌棰勪粯娆句箣鏃ヨ捣 涓湀鍐呮湭鐢熶骇瀹屾垚")
+ private BigDecimal receiveAdvancePaymentMonth;
+
+ @Schema(description = "骞舵彁鍓� 鍚勫伐浣滄棩閫氱煡闇�鏂归獙鏀�")
+ private BigDecimal noticeSupplierAcceptDay;
+
+ @Schema(description = "姣忛�炬湡 鏃�")
+ private BigDecimal overdueDay;
+
+ @Schema(description = "鎸夊悎鍚屾�讳环鐨� 鍋夸粯闇�鏂规崯澶�")
+ private BigDecimal lossAmount;
+
+ @Schema(description = "杩濈害閲戞渶楂樹笉瓒呰繃鍚堝悓鎬讳环鐨�")
+ private BigDecimal liquidatedDamagesHighSupplier;
+
+ @Schema(description = "闇�鏂瑰閫炬湡浠樻姣忛�炬湡 鏃�")
+ private BigDecimal overdueDayXf;
+
+ @Schema(description = "闇�鏂瑰閫炬湡浠樻鎸夊悎鍚屾�讳环鐨� 鍋夸粯闇�鏂规崯澶�")
+ private BigDecimal lossAmountXf;
+
+ @Schema(description = "杩濈害閲戞渶楂樹笉瓒呰繃鍚堝悓鎬讳环鐨�")
+ private BigDecimal liquidatedDamagesHighBuyer;
+
+ @Schema(description = "鏈悎鍚屼竴寮� 浠�")
+ private BigDecimal totalParts;
+
+ @Schema(description = "渚涙柟鎵� 浠�")
+ private BigDecimal supplierPart;
+
+ @Schema(description = "闇�鏂规墽 浠�")
+ private BigDecimal buyerPart;
+
+ private BigDecimal advancePayment;
+
+ @Schema(description = "浠樻鏂瑰紡")
+ private String paymentMethod;
+
private List<ContractPaymentScheduleAddDTO> contractPaymentSchedule;
private List<ContractSubjectMatterAddDTO> contractSubjectMatter;
diff --git a/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/dto/ContractQueryDTO.java b/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/dto/ContractQueryDTO.java
index aaffd87..2784903 100644
--- a/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/dto/ContractQueryDTO.java
+++ b/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/dto/ContractQueryDTO.java
@@ -7,6 +7,8 @@
private String contractName;
+ private String contractNo;
+
private String partyA;
private String billingStatus;
diff --git a/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/dto/ContractSubjectMatterAddDTO.java b/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/dto/ContractSubjectMatterAddDTO.java
index ce6b0c9..14338ba 100644
--- a/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/dto/ContractSubjectMatterAddDTO.java
+++ b/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/dto/ContractSubjectMatterAddDTO.java
@@ -11,6 +11,9 @@
@Data
public class ContractSubjectMatterAddDTO {
+ @Schema(description = "琛屽彿")
+ private String lineNo;
+
@Schema(description = "鏍囩殑鐗╁悕绉�")
private String materialName;
diff --git a/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/dto/GenInvoiceInfoDTO.java b/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/dto/GenInvoiceInfoDTO.java
index dfcfc79..60448be 100644
--- a/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/dto/GenInvoiceInfoDTO.java
+++ b/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/dto/GenInvoiceInfoDTO.java
@@ -10,4 +10,6 @@
private List<ContractOutBoundInvoiceVo> outBoundInvoiceList;
+ private String contractCategory;
+
}
diff --git a/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/dto/OutBoundAddDTO.java b/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/dto/OutBoundAddDTO.java
index 9a19632..bad8ca0 100644
--- a/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/dto/OutBoundAddDTO.java
+++ b/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/dto/OutBoundAddDTO.java
@@ -30,6 +30,9 @@
@Schema(description = "鍗曟嵁璺緞")
private String outBoundAttPaths;
+ @Schema(description = "鍑哄簱鏂瑰紡 0 erp鎺ㄩ�� 1 鎵嬪姩褰曞叆")
+ private String outBoundType;
+
@Schema(description = "鍑哄簱鏍囩殑鐗�")
private List<OutSubjectMatterAddDTO> subjectMatterList;
diff --git a/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/dto/OutSubjectMatterAddDTO.java b/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/dto/OutSubjectMatterAddDTO.java
index 60c0b29..40268fc 100644
--- a/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/dto/OutSubjectMatterAddDTO.java
+++ b/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/dto/OutSubjectMatterAddDTO.java
@@ -10,6 +10,8 @@
private Long id;
+ private String lineNo;
+
@Schema(description = "鏍囩殑鐗╁悕绉�")
private String subjectMatterName;
@@ -19,4 +21,5 @@
@Schema(description = "鍑哄簱鏁伴噺")
private BigDecimal outBoundNum;
+ private BigDecimal unitPrice;
}
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 5502bcc..642f2a7 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
@@ -95,7 +95,7 @@
private Date effectiveDate;
@Schema(description = "浜や粯鍛ㄦ湡")
- @Column(columnDefinition = "int default 0 comment '浜や粯鍛ㄦ湡'")
+ @Column(columnDefinition = "int default 0 comment '浜や粯鍛ㄦ湡 /鏈烘鍘傞攢鍞悎鍚岋紙鏈堬級'")
private Integer deliveryCycle;
@DateTimeFormat(pattern = "yyyy-MM-dd")
@@ -107,6 +107,14 @@
@Schema(description = "鍚堝悓闄勪欢URL")
@Column(columnDefinition = "VARCHAR(500) comment '鍚堝悓闄勪欢URL'")
private String attachmentUrl;
+
+ @Schema(description = "鍚堝悓闄勪欢鍚嶇О")
+ @Column(columnDefinition = "VARCHAR(100) comment '鍚堝悓闄勪欢鍚嶇О'")
+ private String attachmentName;
+
+ @Schema(description = "浜哄憳缂栧彿")
+ @Column(columnDefinition = "VARCHAR(100) comment '浜哄憳缂栧彿'")
+ private String nickName;
@Schema(description = "澶囨敞")
@Column(columnDefinition = "TEXT comment '澶囨敞'")
@@ -131,12 +139,16 @@
@Column(columnDefinition = "bigint comment '楠屾敹鑺傜偣ID'")
private Long acceptScheduleId;
+ @Schema(description = "璐ㄤ繚鑺傜偣ID")
+ @Column(columnDefinition = "bigint comment '璐ㄤ繚鑺傜偣ID'")
+ private Long warrantyScheduleId;
+
@Schema(description = "erp鎺ㄩ�佹爣璇�")
@Column(columnDefinition = "char comment 'erp鎺ㄩ�佹爣璇� 0 鏈帹 1 宸叉帹'")
private String erpPushFlag;
@Schema(description = "寮�绁ㄧ姸鎬�")
- @Column(columnDefinition = "char comment '寮�绁ㄧ姸鎬� 0 涓嶈兘寮�绁� 1 閮ㄥ垎鍙紑 2 寰呭紑 3 宸插紑'")
+ @Column(columnDefinition = "char comment '寮�绁ㄧ姸鎬� 1 寰呭紑 2 鍙紑 3 瀹屾垚'")
private String billingStatus;
@Schema(description = "宸插紑绁ㄩ噾棰�")
@@ -180,15 +192,15 @@
private String environment;
@Schema(description = "鏍囧噯")
- @Column(columnDefinition = "VARCHAR(128) comment '鏍囧噯 涓�鐓ゆ満閲囪喘鍚堝悓鐢�'")
+ @Column(columnDefinition = "VARCHAR(128) comment '鏍囧噯 涓�鐓ゆ満閲囪喘鍚堝悓鐢�/鏈烘鍘傞攢鍞悎鍚�'")
private String standard;
@Schema(description = "璐ㄤ繚鏈� 浣跨敤鏈堟暟")
- @Column(columnDefinition = "decimal(10,0) comment '璐ㄤ繚鏈� 浣跨敤鏈堟暟 涓�鐓ゆ満閲囪喘鍚堝悓鐢�'")
+ @Column(columnDefinition = "decimal(10,0) comment '璐ㄤ繚鏈� 浣跨敤鏈堟暟 涓�鐓ゆ満閲囪喘鍚堝悓鐢�/鏈烘鍘傞攢鍞悎鍚�'")
private BigDecimal useMonth;
@Schema(description = "璐ㄤ繚鏈� 鍙戣揣鍚庢湀鏁�")
- @Column(columnDefinition = "decimal(10,0) comment '璐ㄤ繚鏈� 鍙戣揣鍚庢湀鏁� 涓�鐓ゆ満閲囪喘鍚堝悓鐢�'")
+ @Column(columnDefinition = "decimal(10,0) comment '璐ㄤ繚鏈� 鍙戣揣鍚庢湀鏁� 涓�鐓ゆ満閲囪喘鍚堝悓鐢�/鏈烘鍘傞攢鍞悎鍚�'")
private BigDecimal afterShipMonth;
@Schema(description = "璐ц繍鏂瑰紡")
@@ -196,7 +208,7 @@
private String shipMethod;
@Schema(description = "璐ц繍鍦板潃")
- @Column(columnDefinition = "VARCHAR(128) comment '璐ц繍鍦板潃 涓�鐓ゆ満閲囪喘鍚堝悓鐢�'")
+ @Column(columnDefinition = "VARCHAR(128) comment '璐ц繍鍦板潃 涓�鐓ゆ満閲囪喘鍚堝悓鐢� /鏈烘鍘傞攢鍞悎鍚�'")
private String shipAddress;
@Schema(description = "鍖呰")
@@ -232,7 +244,7 @@
private String court;
@Schema(description = "鏈悎鍚岄檮浠跺寘鎷細")
- @Column(columnDefinition = "VARCHAR(128) comment '鏈悎鍚岄檮浠跺寘鎷細 涓�鐓ゆ満閲囪喘鍚堝悓鐢�'")
+ @Column(columnDefinition = "VARCHAR(128) comment '鏈悎鍚岄檮浠跺寘鎷細 涓�鐓ゆ満閲囪喘鍚堝悓鐢�/鏈烘鍘傞攢鍞悎鍚�'")
private String contractAttchment;
@Schema(description = "鍚堝悓绛捐甯�")
@@ -244,7 +256,7 @@
private String region;
@Schema(description = "寮�绁ㄩ�氱煡鍦� 涓伐浣滄棩鍐�")
- @Column(columnDefinition = "decimal(10,0) comment '寮�绁ㄩ�氱煡鍦� 涓伐浣滄棩鍐� 涓�鐓ゆ満閲囪喘鍚堝悓鐢�'")
+ @Column(columnDefinition = "decimal(10,0) comment '寮�绁ㄩ�氱煡鍦� 涓伐浣滄棩鍐� 涓�鐓ゆ満閲囪喘鍚堝悓鐢� /鏈烘鍘傞攢鍞悎鍚�'")
private BigDecimal invoiceNotice;
@Schema(description = "鍚堝悓鎬讳环绋庣巼")
@@ -258,4 +270,129 @@
@Schema(description = "erp鍚堝悓缂栧彿")
@Column(columnDefinition = "VARCHAR(64) comment 'erp鍚堝悓缂栧彿'")
private String erpContractNo;
+
+ @Schema(description = "鐭冲伐娉垫暟鎹甀D")
+ @Column(columnDefinition = "VARCHAR(128) comment '鐭冲伐娉垫暟鎹甀D'")
+ private String dataId;
+
+ @Schema(description = "琛屼笟")
+ @Column(columnDefinition = "VARCHAR(50) comment '琛屼笟'")
+ private String industryCode;
+
+ @Schema(description = "鍖哄煙")
+ @Column(columnDefinition = "VARCHAR(50) comment '鍖哄煙'")
+ private String areaCode;
+
+ @Schema(description = "闇�鏂瑰湪鎺ュ埌閫氱煡鍚� 鏃ュ唴杩涜妫�楠�")
+ @Column(columnDefinition = "decimal(10,0) comment '鏈烘鍘傞攢鍞悎鍚� 闇�鏂瑰湪鎺ュ埌閫氱煡鍚� 鏃ュ唴杩涜妫�楠�'")
+ private BigDecimal inspectDay;
+
+ @Schema(description = "鏀跺埌渚涙柟閫氱煡鍚� 鏃ュ唴娲句汉楠屾敹")
+ @Column(columnDefinition = "decimal(10,0) comment '鏈烘鍘傞攢鍞悎鍚� 鏀跺埌渚涙柟閫氱煡鍚� 鏃ュ唴娲句汉楠屾敹'")
+ private BigDecimal acceptDay;
+
+ @Schema(description = "寤堕獙鏀惰秴杩� 鏃�")
+ @Column(columnDefinition = "decimal(10,0) comment '鏈烘鍘傞攢鍞悎鍚� 寤堕獙鏀惰秴杩� 鏃�'")
+ private BigDecimal delayAcceptDay;
+
+ @Schema(description = "楠屾敹鍚堟牸鍚� 涓伐浣滄棩")
+ @Column(columnDefinition = "decimal(10,0) comment '鏈烘鍘傞攢鍞悎鍚� 楠屾敹鍚堟牸鍚� 涓伐浣滄棩'")
+ private BigDecimal acceptPassDay;
+
+ @Schema(description = "楠屾敹鍚堟牸鍚戜緵鏂硅冻棰濇敮浠樺悎鍚屾�讳环鐨�")
+ @Column(columnDefinition = "decimal(10,2) comment '鏈烘鍘傞攢鍞悎鍚� 楠屾敹鍚堟牸鍚戜緵鏂硅冻棰濇敮浠樺悎鍚屾�讳环鐨�'")
+ private BigDecimal acceptPassAmount;
+
+ @Schema(description = "鏃ュ唴寮�濮嬪彂璐�")
+ @Column(columnDefinition = "decimal(10,0) comment '鏈烘鍘傞攢鍞悎鍚� 鏃ュ唴寮�濮嬪彂璐�'")
+ private BigDecimal deliverDay;
+
+ @Schema(description = "鏃ュ唴鍙戝畬")
+ @Column(columnDefinition = "decimal(10,0) comment '鏈烘鍘傞攢鍞悎鍚� 鏃ュ唴鍙戝畬'")
+ private BigDecimal deliverCompleteDay;
+
+ @Schema(description = "渚涙柟浠g悊")
+ @Column(columnDefinition = "VARCHAR(50) comment '渚涙柟浠g悊'")
+ private String supplierAgent;
+
+ @Schema(description = "渚涙柟浠g悊韬唤璇�")
+ @Column(name = "supplier_agent_id_card",columnDefinition = "VARCHAR(50) comment '渚涙柟浠g悊韬唤璇�'")
+ private String supplierAgentIdCard;
+
+ @Schema(description = "闇�鏂逛唬鐞�")
+ @Column(columnDefinition = "VARCHAR(50) comment '闇�鏂逛唬鐞�'")
+ private String buyerAgent;
+
+ @Schema(description = "闇�鏂逛唬鐞嗚韩浠借瘉")
+ @Column(name = "buyer_agent_id_card",columnDefinition = "VARCHAR(50) comment '闇�鏂逛唬鐞嗚韩浠借瘉'")
+ private String buyerAgentIdCard;
+
+ @Schema(description = "浠g悊鏉冮檺")
+ @Column(columnDefinition = "VARCHAR(250) comment '浠g悊鏉冮檺'")
+ private String agentAuthority;
+
+ @Schema(description = "闇�鏂瑰悜渚涙柟瓒抽鏀粯棰勪粯娆�")
+ @Column(columnDefinition = "decimal(10,2) comment '鏈烘鍘傞攢鍞悎鍚� 闇�鏂瑰悜渚涙柟瓒抽鏀粯棰勪粯娆�'")
+ private BigDecimal advancePayment;
+
+ @Schema(description = "寤舵湡鏀粯棰勪粯娆�")
+ @Column(columnDefinition = "decimal(10,2) comment '鏈烘鍘傞攢鍞悎鍚� 寤舵湡鏀粯棰勪粯娆�'")
+ private BigDecimal delayPayAdvancePayment;
+
+ @Schema(description = "寤舵湡鏀粯杩涘害娆�")
+ @Column(columnDefinition = "decimal(10,2) comment '鏈烘鍘傞攢鍞悎鍚� 寤舵湡鏀粯杩涘害娆�'")
+ private BigDecimal delayPayProcessPayment;
+
+ @Schema(description = "鏀跺埌棰勪粯娆句箣鏃ヨ捣 涓湀鍐呮湭鐢熶骇瀹屾垚")
+ @Column(columnDefinition = "decimal(10,0) comment '鏈烘鍘傞攢鍞悎鍚� 鏀跺埌棰勪粯娆句箣鏃ヨ捣 涓湀鍐呮湭鐢熶骇瀹屾垚'")
+ private BigDecimal receiveAdvancePaymentMonth;
+
+ @Schema(description = "骞舵彁鍓� 鍚勫伐浣滄棩閫氱煡闇�鏂归獙鏀�")
+ @Column(columnDefinition = "decimal(10,0) comment '鏈烘鍘傞攢鍞悎鍚� 骞舵彁鍓� 鍚勫伐浣滄棩閫氱煡闇�鏂归獙鏀�'")
+ private BigDecimal noticeSupplierAcceptDay;
+
+ @Schema(description = "姣忛�炬湡 鏃�")
+ @Column(columnDefinition = "decimal(10,0) comment '鏈烘鍘傞攢鍞悎鍚� 姣忛�炬湡 鏃�'")
+ private BigDecimal overdueDay;
+
+ @Schema(description = "鎸夊悎鍚屾�讳环鐨� 鍋夸粯闇�鏂规崯澶�")
+ @Column(columnDefinition = "decimal(10,2) comment '鏈烘鍘傞攢鍞悎鍚� 鎸夊悎鍚屾�讳环鐨� 鍋夸粯闇�鏂规崯澶�'")
+ private BigDecimal lossAmount;
+
+ @Schema(description = "杩濈害閲戞渶楂樹笉瓒呰繃鍚堝悓鎬讳环鐨�")
+ @Column(columnDefinition = "decimal(10,2) comment '鏈烘鍘傞攢鍞悎鍚� 杩濈害閲戞渶楂樹笉瓒呰繃鍚堝悓鎬讳环鐨�'")
+ private BigDecimal liquidatedDamagesHighSupplier;
+
+ @Schema(description = "闇�鏂瑰閫炬湡浠樻姣忛�炬湡 鏃�")
+ @Column(columnDefinition = "decimal(10,0) comment '鏈烘鍘傞攢鍞悎鍚� 姣忛�炬湡 鏃�'")
+ private BigDecimal overdueDayXf;
+
+ @Schema(description = "闇�鏂瑰閫炬湡浠樻鎸夊悎鍚屾�讳环鐨� 鍋夸粯闇�鏂规崯澶�")
+ @Column(columnDefinition = "decimal(10,2) comment '鏈烘鍘傞攢鍞悎鍚� 鎸夊悎鍚屾�讳环鐨� 鍋夸粯闇�鏂规崯澶�'")
+ private BigDecimal lossAmountXf;
+
+ @Schema(description = "杩濈害閲戞渶楂樹笉瓒呰繃鍚堝悓鎬讳环鐨�")
+ @Column(columnDefinition = "decimal(10,2) comment '鏈烘鍘傞攢鍞悎鍚� 杩濈害閲戞渶楂樹笉瓒呰繃鍚堝悓鎬讳环鐨�'")
+ private BigDecimal liquidatedDamagesHighBuyer;
+
+ @Schema(description = "鏈悎鍚屼竴寮� 浠�")
+ @Column(columnDefinition = "decimal(10,0) comment '鏈烘鍘傞攢鍞悎鍚� 鏈悎鍚屼竴寮� 浠�'")
+ private BigDecimal totalParts;
+
+ @Schema(description = "渚涙柟鎵� 浠�")
+ @Column(columnDefinition = "decimal(10,0) comment '鏈烘鍘傞攢鍞悎鍚� 渚涙柟鎵� 浠�'")
+ private BigDecimal supplierPart;
+
+ @Schema(description = "闇�鏂规墽 浠�")
+ @Column(columnDefinition = "decimal(10,0) comment '鏈烘鍘傞攢鍞悎鍚� 闇�鏂规墽 浠�'")
+ private BigDecimal buyerPart;
+
+ @Schema(description = "浠樻鏂瑰紡")
+ @Column(columnDefinition = "VARCHAR(50) comment '浠樻鏂瑰紡'")
+ private String paymentMethod;
+
+ @Schema(description = "鍑哄簱閲戦")
+ @Column(columnDefinition = "decimal(10,2) comment '鍑哄簱閲戦'")
+ private BigDecimal outBoundAmout;
+
}
diff --git a/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/entity/ContractOutBound.java b/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/entity/ContractOutBound.java
index 1f3bb7e..ae5273e 100644
--- a/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/entity/ContractOutBound.java
+++ b/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/entity/ContractOutBound.java
@@ -41,6 +41,10 @@
@Column(columnDefinition="bigint comment '瀹㈠晢ID'")
private Long busGuestId;
+ @Schema(description = "鏍囩殑鐗╄鍙�")
+ @Column(columnDefinition = "VARCHAR(10) comment '鏍囩殑鐗╄鍙�'")
+ private String lineNo;
+
@Schema(description = "鏍囩殑鐗╁悕绉�")
@Column(columnDefinition="VARCHAR(64) comment '鏍囩殑鐗╁悕绉�'")
private String subjectMatterName;
diff --git a/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/entity/ContractPaymentSchedule.java b/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/entity/ContractPaymentSchedule.java
index 3fedad4..9eb2f8d 100644
--- a/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/entity/ContractPaymentSchedule.java
+++ b/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/entity/ContractPaymentSchedule.java
@@ -40,12 +40,12 @@
@Column(columnDefinition = "VARCHAR(64) comment '鍚堝悓鍚嶇О'")
private String contractName;
- @Schema(description = "鍏宠仈鏍囩殑鐗㊣D锛堝彲閫夛紝濡傛灉涓虹┖鍒欓�傜敤浜庡悎鍚屾暣浣擄級")
- @Column(columnDefinition = "bigint comment '鍏宠仈鏍囩殑鐗㊣D'")
- private Long subjectMatterId;
+ @Schema(description = "鏍囩殑鐗╃紪鐮侊紙鍙�夛紝濡傛灉涓虹┖鍒欓�傜敤浜庡悎鍚屾暣浣擄級")
+ @Column(columnDefinition = "VARCHAR(64) comment '鏍囩殑鐗╃紪鐮�'")
+ private String subjectMatterCode;
@Schema(description = "鏍囩殑鐗╁悕绉�")
- @Column(columnDefinition = "VARCHAR(64) comment '鏍囩殑鐗╁悕绉�'")
+ @Column(columnDefinition = "VARCHAR(256) comment '鏍囩殑鐗╁悕绉�'")
private String subjectMatterName;
// ==================== 鏀舵闃舵/灞ョ害鑺傜偣鍩烘湰淇℃伅 ====================
@@ -166,6 +166,10 @@
@Column(columnDefinition = "VARCHAR(500) comment '澶囨敞'")
private String remark;
+ @Schema(description = "寮�绁ㄦ爣璇�")
+ @Column(columnDefinition="char comment '寮�绁ㄦ爣璇� 0/鏈紑 1/宸插紑'")
+ private String invoiceFlag;
+
// @Schema(description = "鎺掑簭鍙�")
// @Column(columnDefinition = "int default 0 comment '鎺掑簭鍙�'")
// private Integer sortOrder;
diff --git a/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/entity/ContractSubjectMatter.java b/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/entity/ContractSubjectMatter.java
index b6007cf..9e6e16d 100644
--- a/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/entity/ContractSubjectMatter.java
+++ b/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/entity/ContractSubjectMatter.java
@@ -28,21 +28,13 @@
@EqualsAndHashCode(callSuper = true)
public class ContractSubjectMatter extends BaseModel<ContractSubjectMatter> {
- @Schema(description = "鎺掍骇璁″垝ID")
- @Column(columnDefinition = "bigint comment '鎺掍骇璁″垝ID'")
- private Long productionPlanId;
-
- @Schema(description = "鎺掍骇璁″垝鍚嶇О")
- @Column(columnDefinition = "VARCHAR(200) comment '鎺掍骇璁″垝鍚嶇О'")
- private String productionPlanName;
-
@Schema(description = "鍏宠仈鍚堝悓ID")
@Column(columnDefinition = "bigint comment '鍏宠仈鍚堝悓ID'")
private Long contractId;
- @Schema(description = "鍚堝悓鍚嶇О")
- @Column(columnDefinition = "VARCHAR(200) comment '鍚堝悓鍚嶇О'")
- private String contractName;
+ @Schema(description = "鏍囩殑鐗╄鍙�")
+ @Column(columnDefinition = "VARCHAR(10) comment '鏍囩殑鐗╄鍙�'")
+ private String lineNo;
@Schema(description = "鏍囩殑鐗╁悕绉�")
@Column(columnDefinition = "VARCHAR(200) comment '鏍囩殑鐗╁悕绉�'")
diff --git a/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/entity/MeterReadRecord.java b/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/entity/MeterReadRecord.java
index cd274fb..10df1c7 100644
--- a/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/entity/MeterReadRecord.java
+++ b/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/entity/MeterReadRecord.java
@@ -16,7 +16,7 @@
*/
@Data
@Entity//鍔犱簡鎵嶈兘鑷姩鐢熸垚琛�
-@org.hibernate.annotations.Table(appliesTo="meter_read_record",comment = "姘寸數鎶勮〃璁板綍")//缁欒〃鍔犳敞閲�
+@org.hibernate.annotations.Table(appliesTo="meter_read_record",comment = "鎴跨姘寸數鎶勮〃璁板綍")//缁欒〃鍔犳敞閲�
@jakarta.persistence.Table(name = "meter_read_record")//鏁版嵁搴撳垱寤虹殑琛ㄦ槑
public class MeterReadRecord extends BaseModel<MeterReadRecord>{
@@ -31,6 +31,10 @@
@Schema(description = "鍚堝悓鍚嶇О")
@Column(columnDefinition = "VARCHAR(64) comment '鍚堝悓鍚嶇О'")
private String contractName;
+
+ @Schema(description = "璁板綍绫诲瀷")
+ @Column(columnDefinition = "VARCHAR(64) comment '璁板綍绫诲瀷 1/鎴跨 2/ 姘磋垂 3/ 鐢佃垂'")
+ private String meterType;
@Schema(description = "瀹㈠晢鍚嶇О")
@Column(columnDefinition="VARCHAR(64) comment '瀹㈠晢鍚嶇О'")
@@ -53,6 +57,18 @@
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date meterReadTime;
+ @Schema(description = "鐢ㄩ噺")
+ @Column(columnDefinition="decimal(10,0) comment '鐢ㄩ噺'")
+ private BigDecimal usageNum;
+
+ @Schema(description = "鍗曚环")
+ @Column(columnDefinition = "decimal(10,2) comment '鍗曚环'")
+ private BigDecimal unitPrice;
+
+ @Schema(description = "褰撴湡閲戦")
+ @Column(columnDefinition = "decimal(10,2) comment '褰撴湡閲戦'")
+ private BigDecimal costAmount;
+
@Schema(description = "鎶勮〃鍗曟嵁鍚嶇О")
@Column(columnDefinition="text comment '鍗曟嵁鍚嶇О'")
private String meterReadAttNames;
diff --git a/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/entity/OutBound.java b/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/entity/OutBound.java
index 5628275..c1d4820 100644
--- a/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/entity/OutBound.java
+++ b/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/entity/OutBound.java
@@ -60,4 +60,8 @@
@Schema(description = "鍗曟嵁璺緞")
@Column(columnDefinition="text comment '鍗曟嵁璺緞'")
private String outBoundAttPaths;
+
+ @Schema(description = "鍑哄簱鏂瑰紡 0 erp鎺ㄩ�� 1 鎵嬪姩褰曞叆")
+ @Column(columnDefinition="char comment '鍑哄簱鏂瑰紡 0 erp鎺ㄩ�� 1 鎵嬪姩褰曞叆'")
+ private String outBoundType;
}
diff --git a/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/entity/PaymentSlip.java b/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/entity/PaymentSlip.java
index a7005aa..e4ce98f 100644
--- a/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/entity/PaymentSlip.java
+++ b/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/entity/PaymentSlip.java
@@ -52,4 +52,7 @@
@Column(columnDefinition="VARCHAR(64) comment '浠樻鏂瑰紡'")
private String payType;
+ @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/vo/BusinessCustomerMainVo.java b/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/BusinessCustomerMainVo.java
new file mode 100644
index 0000000..75466af
--- /dev/null
+++ b/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/BusinessCustomerMainVo.java
@@ -0,0 +1,22 @@
+package com.by4cloud.platformx.business.vo;
+
+import lombok.Data;
+
+@Data
+public class BusinessCustomerMainVo {
+
+ private String companyName;
+
+ private String registerName;
+
+ private String legalPerson;
+
+ private String address;
+
+ private String creditCode;
+
+ private String bankName;
+
+ private String bankAccount;
+
+}
diff --git a/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/ContractCreditSalesPageVo.java b/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/ContractCreditSalesPageVo.java
index 97c0ddb..f45474f 100644
--- a/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/ContractCreditSalesPageVo.java
+++ b/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/ContractCreditSalesPageVo.java
@@ -91,6 +91,9 @@
@Schema(description = "鍚堝悓缂栧彿")
private String contractNo;
+ @Schema(description = "涓嬩竴鑺傜偣鍚嶇О")
+ private String nextScheduleName;
+
private List<ContractPaymentSchedule> contractPaymentSchedule;
private List<ContractSubjectMatter> contractSubjectMatter;
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 cdb8461..d79a933 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
@@ -9,6 +9,7 @@
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
+import java.util.Date;
import java.util.List;
@Data
@@ -55,23 +56,23 @@
@Schema(description = "鍚堝悓鏈嶅姟灞炴�э紙0-浜у搧閿�鍞� 1-鏃犲舰鏈嶅姟锛�")
private Integer contractAttribute;
- @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
- @JsonFormat(pattern = "yyyy-MM-dd HH:mm")
+ @DateTimeFormat(pattern = "yyyy-MM-dd")
+ @JsonFormat(pattern = "yyyy-MM-dd")
@Schema(description = "绛剧讲鏃ユ湡")
- private String signDate;
+ private Date signDate;
@Schema(description = "浜や粯鍛ㄦ湡")
private Integer deliveryCycle;
- @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
- @JsonFormat(pattern = "yyyy-MM-dd HH:mm")
+ @DateTimeFormat(pattern = "yyyy-MM-dd")
+ @JsonFormat(pattern = "yyyy-MM-dd")
@Schema(description = "鐢熸晥鏃ユ湡")
- private String effectiveDate;
+ private Date effectiveDate;
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd")
@Schema(description = "鍒版湡鏃ユ湡")
- private String expirationDate;
+ private Date expirationDate;
@Schema(description = "鍚堝悓闄勪欢URL")
private String attachmentUrl;
@@ -157,6 +158,87 @@
@Schema(description = "缁忔祹浜嬮」 bip鎺ㄩ�佸簲鏀剁敤")
private String economicMatters;
+ private String industryCode;
+
+ @Schema(description = "闇�鏂瑰湪鎺ュ埌閫氱煡鍚� 鏃ュ唴杩涜妫�楠�")
+ private BigDecimal inspectDay;
+
+ @Schema(description = "鏀跺埌渚涙柟閫氱煡鍚� 鏃ュ唴娲句汉楠屾敹")
+ private BigDecimal acceptDay;
+
+ @Schema(description = "寤堕獙鏀惰秴杩� 鏃�")
+ private BigDecimal delayAcceptDay;
+
+ @Schema(description = "楠屾敹鍚堟牸鍚� 涓伐浣滄棩")
+ private BigDecimal acceptPassDay;
+
+ @Schema(description = "楠屾敹鍚堟牸鍚戜緵鏂硅冻棰濇敮浠樺悎鍚屾�讳环鐨�")
+ private BigDecimal acceptPassAmount;
+
+ @Schema(description = "鏃ュ唴寮�濮嬪彂璐�")
+ private BigDecimal deliverDay;
+
+ @Schema(description = "鏃ュ唴鍙戝畬")
+ private BigDecimal deliverCompleteDay;
+
+ @Schema(description = "渚涙柟浠g悊")
+ private String supplierAgent;
+
+ @Schema(description = "渚涙柟浠g悊韬唤璇�")
+ private String supplierAgentIdCard;
+
+ @Schema(description = "闇�鏂逛唬鐞�")
+ private String buyerAgent;
+
+ @Schema(description = "闇�鏂逛唬鐞嗚韩浠借瘉")
+ private String buyerAgentIdCard;
+
+ private String agentAuthority;
+
+ @Schema(description = "寤舵湡鏀粯棰勪粯娆�")
+ private BigDecimal delayPayAdvancePayment;
+
+ @Schema(description = "寤舵湡鏀粯杩涘害娆�")
+ private BigDecimal delayPayProcessPayment;
+
+ @Schema(description = "鏀跺埌棰勪粯娆句箣鏃ヨ捣 涓湀鍐呮湭鐢熶骇瀹屾垚")
+ private BigDecimal receiveAdvancePaymentMonth;
+
+ @Schema(description = "骞舵彁鍓� 鍚勫伐浣滄棩閫氱煡闇�鏂归獙鏀�")
+ private BigDecimal noticeSupplierAcceptDay;
+
+ @Schema(description = "姣忛�炬湡 鏃�")
+ private BigDecimal overdueDay;
+
+ @Schema(description = "鎸夊悎鍚屾�讳环鐨� 鍋夸粯闇�鏂规崯澶�")
+ private BigDecimal lossAmount;
+
+ @Schema(description = "杩濈害閲戞渶楂樹笉瓒呰繃鍚堝悓鎬讳环鐨�")
+ private BigDecimal liquidatedDamagesHighSupplier;
+
+ @Schema(description = "闇�鏂瑰閫炬湡浠樻姣忛�炬湡 鏃�")
+ private BigDecimal overdueDayXf;
+
+ @Schema(description = "闇�鏂瑰閫炬湡浠樻鎸夊悎鍚屾�讳环鐨� 鍋夸粯闇�鏂规崯澶�")
+ private BigDecimal lossAmountXf;
+
+ @Schema(description = "杩濈害閲戞渶楂樹笉瓒呰繃鍚堝悓鎬讳环鐨�")
+ private BigDecimal liquidatedDamagesHighBuyer;
+
+ @Schema(description = "鏈悎鍚屼竴寮� 浠�")
+ private BigDecimal totalParts;
+
+ @Schema(description = "渚涙柟鎵� 浠�")
+ private BigDecimal supplierPart;
+
+ @Schema(description = "闇�鏂规墽 浠�")
+ private BigDecimal buyerPart;
+
+ @Schema(description = "浠樻鏂瑰紡")
+ private String paymentMethod;
+
+ private BigDecimal advancePayment;
+
private List<ContractPaymentSchedule> contractPaymentSchedule;
private List<ContractSubjectMatter> contractSubjectMatter;
diff --git a/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/ContractHouseWaterVo.java b/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/ContractHouseWaterVo.java
new file mode 100644
index 0000000..3516134
--- /dev/null
+++ b/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/ContractHouseWaterVo.java
@@ -0,0 +1,27 @@
+package com.by4cloud.platformx.business.vo;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+public class ContractHouseWaterVo {
+
+ private Long id;
+
+ @Schema(description = "鏍囩殑鐗╁悕绉�")
+ private String subjectMatterName;
+
+ @Schema(description = "鏍囩殑鐗╃紪鐮�")
+ private String subjectMatterCode;
+
+ @Schema(description = "璁″垝鏀舵閲戦")
+ private BigDecimal plannedAmount;
+
+ @Schema(description = "澶囨敞")
+ private String remark;
+
+ @Schema(description = "澶囨敞")
+ private String invoiceFlag;
+}
diff --git a/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/ContractInvoiceOutBoundVo.java b/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/ContractInvoiceOutBoundVo.java
index a61ab39..7f9b4a2 100644
--- a/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/ContractInvoiceOutBoundVo.java
+++ b/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/ContractInvoiceOutBoundVo.java
@@ -1,10 +1,12 @@
package com.by4cloud.platformx.business.vo;
+import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.persistence.Column;
import lombok.Data;
import java.math.BigDecimal;
+import java.util.Date;
@Data
public class ContractInvoiceOutBoundVo {
@@ -23,6 +25,10 @@
@Schema(description = "鍑哄簱鏁伴噺")
private BigDecimal outBoundNum;
+ @Schema(description = "鍑哄簱鏃ユ湡")
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ private Date outBoundTime;
+
@Schema(description = "寮�绁ㄦ暟閲�")
private BigDecimal invoiceNum;
diff --git a/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/ContractInvoicePageVo.java b/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/ContractInvoicePageVo.java
new file mode 100644
index 0000000..ee3996a
--- /dev/null
+++ b/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/ContractInvoicePageVo.java
@@ -0,0 +1,92 @@
+package com.by4cloud.platformx.business.vo;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+@Data
+public class ContractInvoicePageVo {
+ private Long id;
+
+ @Schema(description = "鍚堝悓缂栧彿")
+ private String contractNo;
+
+ @Schema(description = "鍚堝悓鍚嶇О")
+ private String contractName;
+
+ @Schema(description = "鐢叉柟id")
+ private Long partyAId;
+
+ @Schema(description = "鐢叉柟鍚嶇О")
+ private String partyA;
+
+ @Schema(description = "涔欐柟id")
+ private Long partyBId;
+
+ @Schema(description = "涔欐柟鍚嶇О")
+ private String partyB;
+
+ @Schema(description = "鍚堝悓閲戦")
+ private BigDecimal amount;
+
+ @Schema(description = "甯佺锛圕NY/USD绛夛級")
+ private String currency;
+
+ @Schema(description = "鍚堝悓绫诲瀷锛�0-鐢熸垚寮� 1-澶囨寮忥級")
+ private Integer contractType;
+
+ @Schema(description = "渚涘簲灞炴�� 0-鎴愬搧 1-澶囦欢 2-澶т慨 3-鍏朵粬")
+ private Integer supplyAttribute;
+
+ @Schema(description = "鍚堝悓鐘舵�侊紙0-鑽夌 1-宸茬敓鏁� 2-宸茬粓姝� 3-宸茶繃鏈燂級")
+ private Integer contractStatus;
+
+ @Schema(description = "鍚堝悓鏈嶅姟灞炴�э紙0-浜у搧閿�鍞� 1-鏃犲舰鏈嶅姟锛�")
+ private Integer contractAttribute;
+
+ @DateTimeFormat(pattern = "yyyy-MM-dd")
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ @Schema(description = "绛剧讲鏃ユ湡")
+ private Date signDate;
+
+ @Schema(description = "绛捐鍦扮偣")
+ private String signPlace;
+
+ @DateTimeFormat(pattern = "yyyy-MM-dd")
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ @Schema(description = "鐢熸晥鏃ユ湡")
+ private Date effectiveDate;
+
+ @Schema(description = "浜や粯鍛ㄦ湡")
+ private Integer deliveryCycle;
+
+ @DateTimeFormat(pattern = "yyyy-MM-dd")
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ @Schema(description = "鍒版湡鏃ユ湡")
+ private Date expirationDate;
+
+ @Schema(description = "鍚堝悓闄勪欢URL")
+ private String attachmentUrl;
+
+ @Schema(description = "澶囨敞")
+ private String remark;
+
+ @Schema(description = "寮�绁ㄧ姸鎬�")
+ private String billingStatus;
+
+ @Schema(description = "宸插紑绁ㄩ噾棰�")
+ private BigDecimal billingAmout;
+
+ @Schema(description = "宸蹭粯娆鹃噾棰�")
+ private BigDecimal paidAmount;
+
+ @Schema(description = "鍚堝悓鍒嗙被")
+ private String contractCategory;
+
+ @Schema(description = "鍚堝悓鍒嗙被")
+ private Integer invoiceNum;
+}
diff --git a/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/ContractInvoiceVo.java b/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/ContractInvoiceVo.java
new file mode 100644
index 0000000..865dec9
--- /dev/null
+++ b/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/ContractInvoiceVo.java
@@ -0,0 +1,16 @@
+package com.by4cloud.platformx.business.vo;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+
+import java.util.Date;
+
+@Data
+public class ContractInvoiceVo {
+
+ private String invoiceNo;
+
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private Date invoiceTime;
+
+}
diff --git a/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/ContractOutBoundInvoiceVo.java b/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/ContractOutBoundInvoiceVo.java
index 55cda92..7080405 100644
--- a/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/ContractOutBoundInvoiceVo.java
+++ b/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/ContractOutBoundInvoiceVo.java
@@ -11,4 +11,6 @@
private BigDecimal invoiceNum;
+ private BigDecimal invoiceAmount;
+
}
diff --git a/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/ContractOutBoundMergeVo.java b/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/ContractOutBoundMergeVo.java
index db548d9..514393e 100644
--- a/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/ContractOutBoundMergeVo.java
+++ b/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/ContractOutBoundMergeVo.java
@@ -39,4 +39,7 @@
@Schema(description = "绋庢敹鍒嗙被缂栫爜")
private String taxCode;
+
+ @Schema(description = "鏀舵")
+ private BigDecimal priceAndTax;
}
diff --git a/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/ContractPageVo.java b/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/ContractPageVo.java
index 522511c..40d0252 100644
--- a/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/ContractPageVo.java
+++ b/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/ContractPageVo.java
@@ -2,7 +2,6 @@
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
-import jakarta.persistence.Column;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
@@ -44,7 +43,6 @@
private Integer supplyAttribute;
@Schema(description = "鍚堝悓鐘舵�侊紙0-鑽夌 1-宸茬敓鏁� 2-宸茬粓姝� 3-宸茶繃鏈燂級")
- @Column(columnDefinition = "tinyint(2) default 0 comment '鍚堝悓鐘舵��'")
private Integer contractStatus;
@Schema(description = "鍚堝悓鏈嶅姟灞炴�э紙0-浜у搧閿�鍞� 1-鏃犲舰鏈嶅姟锛�")
@@ -184,4 +182,7 @@
@Schema(description = "鍑哄簱閲戦")
private BigDecimal outAmount;
+
+ @Schema(description = "璐ㄤ繚鑺傜偣ID")
+ private Long warrantyScheduleId;
}
diff --git a/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/ContractSlipVo.java b/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/ContractSlipVo.java
new file mode 100644
index 0000000..a679ed6
--- /dev/null
+++ b/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/ContractSlipVo.java
@@ -0,0 +1,16 @@
+package com.by4cloud.platformx.business.vo;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+
+import java.util.Date;
+
+@Data
+public class ContractSlipVo {
+
+ private String paymentNumber;
+
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private Date paymentTime;
+
+}
diff --git a/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/CustInfoVo.java b/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/CustInfoVo.java
index b175619..eb74d32 100644
--- a/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/CustInfoVo.java
+++ b/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/CustInfoVo.java
@@ -9,7 +9,7 @@
private String custName;
- private String legalGerson;
+ private String legalPerson;
private String registrationAddress;
}
diff --git a/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/FourAssociationPageVo.java b/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/FourAssociationPageVo.java
new file mode 100644
index 0000000..5e9e20b
--- /dev/null
+++ b/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/FourAssociationPageVo.java
@@ -0,0 +1,31 @@
+package com.by4cloud.platformx.business.vo;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.List;
+
+@Data
+public class FourAssociationPageVo {
+
+ private Long id;
+
+ private String contractNo;
+
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ private Date signDate;
+
+ private BigDecimal amount;
+
+ private BigDecimal billingAmout;
+
+ private BigDecimal paidAmount;
+
+ private List<ContractSlipVo> slipVoList;
+
+ private List<ContractInvoiceVo> invoiceVoList;
+
+ private String association;
+}
diff --git a/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/GenInvoiceInfoVo.java b/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/GenInvoiceInfoVo.java
index 3db1a7f..7a46019 100644
--- a/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/GenInvoiceInfoVo.java
+++ b/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/GenInvoiceInfoVo.java
@@ -9,6 +9,9 @@
@Data
public class GenInvoiceInfoVo {
+ @Schema(description = "鍚堝悓绫诲瀷")
+ private String contractCategory;
+
@Schema(description = "鐢叉柟鍚嶇О")
private String partyA;
diff --git a/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/InvoiceItemVo.java b/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/InvoiceItemVo.java
index 4ae4158..3262c93 100644
--- a/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/InvoiceItemVo.java
+++ b/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/vo/InvoiceItemVo.java
@@ -33,6 +33,9 @@
@Schema(description = "绋庨")
private BigDecimal priceTax;
+ @Schema(description = "閲戦鍚◣")
+ private BigDecimal priceAndTax;
+
@Schema(description = "绋庢敹鍒嗙被缂栫爜")
private String taxCode;
}
diff --git a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/controller/BusinessCustomerController.java b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/controller/BusinessCustomerController.java
index 25f50c3..af46a66 100644
--- a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/controller/BusinessCustomerController.java
+++ b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/controller/BusinessCustomerController.java
@@ -151,8 +151,17 @@
* @return R
*/
@Inner(value = false)
- @GetMapping("/syncMainBusCus" )
- public R syncMainBusCus() {
- return R.ok(businessCustomerService.syncMainBusCus());
+ @GetMapping("/syncMainBusCus/{compId}" )
+ public R syncMainBusCus(@PathVariable("compId")String compId) {
+ return R.ok(businessCustomerService.syncMainBusCus(compId));
+ }
+
+ /**
+ * 鍚屾涓绘暟鎹� 浼佷笟鍚嶇О 娉曚汉 涓夊悎涓�鐮� 閾惰淇℃伅
+ * @return R
+ */
+ @GetMapping("/queryMainBC/{companyName}" )
+ public R queryMainBC(@PathVariable("companyName")String companyName) {
+ return R.ok(businessCustomerService.queryMainBC(companyName));
}
}
\ No newline at end of file
diff --git a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/controller/ContractController.java b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/controller/ContractController.java
index ce68204..f858f61 100644
--- a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/controller/ContractController.java
+++ b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/controller/ContractController.java
@@ -6,10 +6,7 @@
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.ContracQueryDTO;
-import com.by4cloud.platformx.business.dto.ContractAddDTO;
-import com.by4cloud.platformx.business.dto.ContractUpdateDTO;
-import com.by4cloud.platformx.business.dto.DelayOutApprovalDTO;
+import com.by4cloud.platformx.business.dto.*;
import com.by4cloud.platformx.business.entity.Contract;
import com.by4cloud.platformx.common.core.util.R;
import com.by4cloud.platformx.common.data.mybatis.BaseModel;
@@ -136,8 +133,10 @@
* list 涓嬫媺
*/
@GetMapping("/list")
- public R list() {
- return R.ok(contractService.list(Wrappers.<Contract>lambdaQuery().eq(Contract::getContractStatus,2).orderByDesc(Contract::getCreateTime)));
+ public R list(@ParameterObject Contract contract) {
+ return R.ok(contractService.listByScope(Wrappers.<Contract>lambdaQuery().eq(Contract::getContractStatus,2)
+ .eq(ObjUtil.isNotNull(contract.getPartyAId()),Contract::getPartyAId,contract.getPartyAId())
+ .orderByDesc(Contract::getCreateTime)));
}
/**
@@ -252,6 +251,29 @@
contractService.exportContractTFGSGYPMMWord(id,response);
}
+ /**
+ * 鏍规嵁妯$増鐢熸垚word鐭崇叅鏈哄伐涓氬搧涔板崠鍚堝悓
+ * @param id id
+ * @return R
+ */
+ @Operation(summary = "鏍规嵁妯$増鐢熸垚word鍚堝悓" , description = "鏍规嵁妯$増鐢熸垚word鍚堝悓" )
+ @GetMapping("/exportContractSMJGYPMMWord/{id}" )
+ public void exportContractSMJGYPMMWord(@PathVariable("id" ) Long id, HttpServletResponse response) {
+ contractService.exportContractSMJGYPMMWord(id,response);
+ }
+
+ /**
+ * 鏍规嵁妯$増鐢熸垚word鏈烘鍘傞攢鍞悎鍚�
+ * @param id id
+ * @return R
+ */
+ @Operation(summary = "鏍规嵁妯$増鐢熸垚word鏈烘鍘傞攢鍞悎鍚�" , description = "鏍规嵁妯$増鐢熸垚word鏈烘鍘傞攢鍞悎鍚�" )
+ @GetMapping("/exportContractJXCXSWord/{id}" )
+ public void exportContractJXCXSWord(@PathVariable("id" ) Long id, HttpServletResponse response) {
+ contractService.exportContractJXCXSWord(id,response);
+ }
+
+
/**
* 寤舵湡鍑鸿揣瀹℃壒
@@ -283,4 +305,36 @@
public R updateContractSgb(@RequestBody ContractUpdateDTO updateDTO) {
return contractService.updateContractSgb(updateDTO);
}
+
+ /**
+ * 缁堟鍚堝悓-鐭冲伐娉�
+ * @return R
+ */
+ @Operation(summary = "缁堟鍚堝悓-鐭冲伐娉�" , description = "缁堟鍚堝悓-鐭冲伐娉�" )
+ @GetMapping("/abortContractSgb/{dataId}")
+ @SysLog("缁堟鍚堝悓-鐭冲伐娉�" )
+ public R abortContractSgb(@PathVariable String dataId) {
+ return contractService.abortContractSgb(dataId);
+ }
+
+ /**
+ * 鍒犻櫎鍚堝悓-鐭冲伐娉�
+ * @return R
+ */
+ @Operation(summary = "鍒犻櫎鍚堝悓-鐭冲伐娉�" , description = "鍒犻櫎鍚堝悓-鐭冲伐娉�" )
+ @PostMapping("/delContractSgb/{dataId}")
+ @SysLog("鍒犻櫎鍚堝悓-鐭冲伐娉�" )
+ public R delContractSgb(@PathVariable String dataId) {
+ return contractService.delContractSgb(dataId);
+ }
+
+ /**
+ * 鍥涘叧鑱旀煡璇�
+ * @return R
+ */
+ @Operation(summary = "鍥涘叧鑱旀煡璇�" , description = "鍥涘叧鑱旀煡璇�" )
+ @GetMapping("/fourAssociation")
+ public R fourAssociation(@ParameterObject Page page,@ParameterObject ContractQueryDTO queryDTO) {
+ return R.ok(contractService.fourAssociation(page,queryDTO));
+ }
}
\ No newline at end of file
diff --git a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/controller/ContractInvoiceController.java b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/controller/ContractInvoiceController.java
index 4296f4a..b5eb269 100644
--- a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/controller/ContractInvoiceController.java
+++ b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/controller/ContractInvoiceController.java
@@ -48,23 +48,23 @@
@Operation(summary = "鍒嗛〉鏌ヨ" , description = "鍒嗛〉鏌ヨ" )
@GetMapping("/page" )
public R getContractPage(@ParameterObject Page page, @ParameterObject ContractQueryDTO queryDTO) {
- LambdaQueryWrapper<Contract> wrapper = Wrappers.lambdaQuery();
- wrapper.like(StringUtils.isNotBlank(queryDTO.getContractName()),Contract::getContractName,queryDTO.getContractName());
- wrapper.like(StringUtils.isNotBlank(queryDTO.getPartyA()),Contract::getPartyA,queryDTO.getPartyA());
- wrapper.eq(Contract::getBillingStatus,queryDTO.getBillingStatus());
- if (StrUtil.equals(queryDTO.getInvoiceType(),"1")){
- wrapper.eqSql(Contract::getBillingAmout,"(select sum(delivered_quantity*unit_price) from contract_subject_matter csm where csm.contract_id = contract.id)");
- }else if (StrUtil.equals(queryDTO.getInvoiceType(),"0")){
- wrapper.ltSql(Contract::getBillingAmout,"(select sum(delivered_quantity*unit_price) from contract_subject_matter csm where csm.contract_id = contract.id)");
- }
+// LambdaQueryWrapper<Contract> wrapper = Wrappers.lambdaQuery();
+// wrapper.like(StringUtils.isNotBlank(queryDTO.getContractName()),Contract::getContractName,queryDTO.getContractName());
+// wrapper.like(StringUtils.isNotBlank(queryDTO.getPartyA()),Contract::getPartyA,queryDTO.getPartyA());
+// wrapper.eq(Contract::getBillingStatus,queryDTO.getBillingStatus());
+// if (StrUtil.equals(queryDTO.getInvoiceType(),"1")){
+// wrapper.eqSql(Contract::getBillingAmout,"(select sum(delivered_quantity*unit_price) from contract_subject_matter csm where csm.contract_id = contract.id)");
+// }else if (StrUtil.equals(queryDTO.getInvoiceType(),"0")){
+// wrapper.ltSql(Contract::getBillingAmout,"(select sum(delivered_quantity*unit_price) from contract_subject_matter csm where csm.contract_id = contract.id)");
+// }
+//
+// if (StrUtil.equals(queryDTO.getBillingStatus(),"1")){
+// wrapper.orderByDesc(BaseModel::getCreateTime);
+// }else {
+// wrapper.orderByAsc(BaseModel::getCreateTime);
+// }
- if (StrUtil.equals(queryDTO.getBillingStatus(),"1")){
- wrapper.orderByDesc(BaseModel::getCreateTime);
- }else {
- wrapper.orderByAsc(BaseModel::getCreateTime);
- }
-
- return R.ok(contractService.pageByScope(page, wrapper));
+ return R.ok(contractInvoiceService.pageScope(page, queryDTO));
}
/**
@@ -74,6 +74,15 @@
@GetMapping("/getContractOutBound/{contractId}" )
public R getContractOutBound(@PathVariable("contractId")Long contractId) {
return contractInvoiceService.getContractOutBound(contractId);
+ }
+
+ /**
+ * 鑾峰彇鍚堝悓鎴跨 姘寸數 璐圭敤淇℃伅
+ * @return
+ */
+ @GetMapping("/getContractHouseWater/{contractId}" )
+ public R getContractHouseWater(@PathVariable("contractId")Long contractId) {
+ return contractInvoiceService.getContractHouseWater(contractId);
}
/**
@@ -136,4 +145,5 @@
public R pageInvoice(@ParameterObject Page page, @ParameterObject ContractInvoiceQueryDTO queryDTO) {
return R.ok(contractInvoiceService.pageInvoice(page, queryDTO));
}
+
}
diff --git a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/controller/OutBoundController.java b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/controller/OutBoundController.java
index 3b692ef..a24f8af 100644
--- a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/controller/OutBoundController.java
+++ b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/controller/OutBoundController.java
@@ -138,4 +138,16 @@
public List<OutBound> export(OutBound outBound,Long[] ids) {
return outBoundService.list(Wrappers.lambdaQuery(outBound).in(ArrayUtil.isNotEmpty(ids), OutBound::getId, ids));
}
+
+ /**
+ * 閫氳繃鎵规鍙峰垹闄PR鍑哄簱璁板綍
+ * @param batchNumber
+ * @return R
+ */
+ @Operation(summary = "閫氳繃鎵规鍙峰垹闄PR鍑哄簱璁板綍" , description = "閫氳繃鎵规鍙峰垹闄PR鍑哄簱璁板綍" )
+ @SysLog("閫氳繃鎵规鍙峰垹闄PR鍑哄簱璁板綍" )
+ @GetMapping("/delOutBound/{batchNumber}")
+ public R delOutBound(@PathVariable("batchNumber")String batchNumber) {
+ return outBoundService.delOutBound(batchNumber);
+ }
}
\ No newline at end of file
diff --git a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/controller/PaymentConfirmController.java b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/controller/PaymentConfirmController.java
index a50c169..5b93ae8 100644
--- a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/controller/PaymentConfirmController.java
+++ b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/controller/PaymentConfirmController.java
@@ -128,13 +128,7 @@
return paymentConfirmService.list(Wrappers.lambdaQuery(paymentConfirm).in(ArrayUtil.isNotEmpty(ids), PaymentConfirm::getId, ids));
}
- /**
- * 瀹氭椂鏌ヨ鏀舵鍗�
- */
- @GetMapping("syncPaymentRecepit")
- public R syncPaymentRecepit(){
- return paymentConfirmService.syncPaymentRecepit();
- }
+
/**
* 涓氬姟绫诲瀷
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 ed1e80f..21aa500 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
@@ -9,6 +9,7 @@
import com.by4cloud.platformx.business.dto.PaymentSlipQueryDTO;
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 io.swagger.v3.oas.annotations.Operation;
@@ -36,6 +37,7 @@
public class PaymentSlipController {
private final PaymentSlipService paymentSlipService;
+ private final PaymentConfirmService paymentConfirmService;
/**
* 鍒嗛〉鏌ヨ
@@ -48,4 +50,11 @@
return R.ok(paymentSlipService.pageScope(page, queryDTO));
}
+ /**
+ * 瀹氭椂鏌ヨ鏀舵鍗�
+ */
+ @GetMapping("syncPaymentRecepit")
+ public R syncPaymentRecepit(){
+ return paymentConfirmService.syncPaymentRecepit();
+ }
}
diff --git a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/mapper/BipBanklViewMapper.java b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/mapper/BipBanklViewMapper.java
index c372edf..f0fa2cc 100644
--- a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/mapper/BipBanklViewMapper.java
+++ b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/mapper/BipBanklViewMapper.java
@@ -5,10 +5,12 @@
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
+import java.util.List;
+
@Mapper
@DS("druid_bip_bank_view")
public interface BipBanklViewMapper {
@Select("SELECT bnts.bank_name_code,bnts.bank_name_name FROM tenant_5.bank_name_tra_send AS bnts WHERE bnts.bank_name_code = #{bankName}")
- BankNameVo selectBankByCode(String bankName);
+ List<BankNameVo> selectBankByCode(String bankName);
}
diff --git a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/mapper/BipViewMapper.java b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/mapper/BipViewMapper.java
index 8e8f2d0..b80a290 100644
--- a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/mapper/BipViewMapper.java
+++ b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/mapper/BipViewMapper.java
@@ -6,13 +6,15 @@
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
+import java.util.List;
+
@Mapper
@DS("druid_bip_view")
public interface BipViewMapper {
- @Select("select certificate_id, cust_name,legal_person,registration_address from mdm_send.mdm_cust_base_info_tra_send WHERE cust_name = #{companyName}")
+ @Select("select certificate_id, cust_name,legal_person,registration_address from mdm_send.mdm_cust_base_info_tra_send WHERE is_deleted = '0' and cust_name = #{companyName}")
CustInfoVo selectBaseInfoByCustName(String companyName);
- @Select("SELECT mcbats.bank_account,mcbats.bank_name FROM mdm_send.mdm_cust_bank_account_tra_send AS mcbats WHERE holder_name = #{companyName}")
- CustBankVo selectBankByCustName(String companyName);
+ @Select("SELECT mcbats.bank_account,mcbats.bank_name FROM mdm_send.mdm_cust_bank_account_tra_send AS mcbats WHERE is_deleted = '0' and holder_name = #{companyName}")
+ List<CustBankVo> selectBankByCustName(String companyName);
}
diff --git a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/mapper/ContractInvoiceMapper.java b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/mapper/ContractInvoiceMapper.java
index 02b0fd4..6b480e3 100644
--- a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/mapper/ContractInvoiceMapper.java
+++ b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/mapper/ContractInvoiceMapper.java
@@ -2,7 +2,9 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.by4cloud.platformx.business.dto.ContractInvoiceQueryDTO;
+import com.by4cloud.platformx.business.dto.ContractQueryDTO;
import com.by4cloud.platformx.business.entity.ContractInvoice;
+import com.by4cloud.platformx.business.vo.ContractInvoicePageVo;
import com.by4cloud.platformx.business.vo.HomeInvoiceVo;
import com.by4cloud.platformx.business.vo.HomeZbjtVo;
import com.by4cloud.platformx.business.vo.HomeZgsVo;
@@ -18,4 +20,6 @@
HomeZgsVo homeZgs(@Param("compId") Long compId);
Page<HomeInvoiceVo> pageInvoice(Page page,@Param("queryDTO") ContractInvoiceQueryDTO queryDTO, DataScope comp_id);
+
+ Page<ContractInvoicePageVo> pageScope(Page page,@Param("queryDTO") ContractQueryDTO queryDTO, DataScope comp_id);
}
diff --git a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/mapper/ContractMapper.java b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/mapper/ContractMapper.java
index a52f5b5..933b6c2 100644
--- a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/mapper/ContractMapper.java
+++ b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/mapper/ContractMapper.java
@@ -3,9 +3,11 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.by4cloud.platformx.business.dto.AnalysisCommonDTO;
import com.by4cloud.platformx.business.dto.ContracQueryDTO;
+import com.by4cloud.platformx.business.dto.ContractQueryDTO;
import com.by4cloud.platformx.business.dto.CreditSalesQueryDTO;
import com.by4cloud.platformx.business.entity.Contract;
import com.by4cloud.platformx.business.vo.*;
+import com.by4cloud.platformx.common.core.util.R;
import com.by4cloud.platformx.common.data.datascope.DataScope;
import com.by4cloud.platformx.common.data.datascope.PlatformxBaseMapper;
import org.apache.ibatis.annotations.Mapper;
@@ -66,4 +68,6 @@
HomeZbjtVo homeZbjt();
HomeZgsVo homeZgs(@Param("compId") Long compId);
+
+ Page<FourAssociationPageVo> fourAssociation(Page page,@Param("queryDTO") ContractQueryDTO queryDTO, DataScope comp_id);
}
diff --git a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/BusinessCustomerService.java b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/BusinessCustomerService.java
index 3655cd2..22b00bf 100644
--- a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/BusinessCustomerService.java
+++ b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/BusinessCustomerService.java
@@ -1,11 +1,13 @@
package com.by4cloud.platformx.business.service;
-import com.baomidou.mybatisplus.extension.service.IService;
import com.by4cloud.platformx.business.entity.BusinessCustomer;
+import com.by4cloud.platformx.business.vo.BusinessCustomerMainVo;
import com.by4cloud.platformx.common.core.util.R;
import com.by4cloud.platformx.common.data.mybatis.IIService;
public interface BusinessCustomerService extends IIService<BusinessCustomer> {
- R syncMainBusCus();
+ R syncMainBusCus(String compId);
+
+ BusinessCustomerMainVo queryMainBC(String companyName);
}
\ No newline at end of file
diff --git a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/ContractInvoiceService.java b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/ContractInvoiceService.java
index b84be6d..a38f49e 100644
--- a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/ContractInvoiceService.java
+++ b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/ContractInvoiceService.java
@@ -2,6 +2,7 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.by4cloud.platformx.business.dto.ContractInvoiceQueryDTO;
+import com.by4cloud.platformx.business.dto.ContractQueryDTO;
import com.by4cloud.platformx.business.dto.GenInvoiceInfoDTO;
import com.by4cloud.platformx.common.core.util.R;
@@ -25,4 +26,8 @@
void refuseApproval(Long id);
Page pageInvoice(Page page, ContractInvoiceQueryDTO queryDTO);
+
+ Page pageScope(Page page, ContractQueryDTO queryDTO);
+
+ R getContractHouseWater(Long contractId);
}
diff --git a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/ContractService.java b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/ContractService.java
index 6fc6316..b3394f0 100644
--- a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/ContractService.java
+++ b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/ContractService.java
@@ -55,4 +55,13 @@
R updateContractSgb(ContractUpdateDTO addDTO);
+ R abortContractSgb(String dataId);
+
+ R delContractSgb(String dataId);
+
+ Page fourAssociation(Page page,ContractQueryDTO queryDTO);
+
+ void exportContractSMJGYPMMWord(Long id, HttpServletResponse response);
+
+ void exportContractJXCXSWord(Long id, HttpServletResponse response);
}
diff --git a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/OutBoundService.java b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/OutBoundService.java
index 79ede4c..64f62fc 100644
--- a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/OutBoundService.java
+++ b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/OutBoundService.java
@@ -10,4 +10,6 @@
R add(OutBoundAddDTO addDTO);
R addContractOut(OutBoundAddDTO addDTO);
+
+ R delOutBound(String batchNumber);
}
\ No newline at end of file
diff --git a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/PaymentSlipService.java b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/PaymentSlipService.java
index c3719cf..fa6f220 100644
--- a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/PaymentSlipService.java
+++ b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/PaymentSlipService.java
@@ -3,8 +3,10 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.by4cloud.platformx.business.dto.PaymentSlipQueryDTO;
import com.by4cloud.platformx.business.entity.PaymentSlip;
+import com.by4cloud.platformx.common.core.util.R;
import com.by4cloud.platformx.common.data.mybatis.IIService;
public interface PaymentSlipService extends IIService<PaymentSlip> {
Page pageScope(Page page, PaymentSlipQueryDTO queryDTO);
+
}
diff --git a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/BusinessCustomerServiceImpl.java b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/BusinessCustomerServiceImpl.java
index fcdd569..0767e4d 100644
--- a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/BusinessCustomerServiceImpl.java
+++ b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/BusinessCustomerServiceImpl.java
@@ -11,6 +11,7 @@
import com.by4cloud.platformx.business.mapper.BusinessCustomerMapper;
import com.by4cloud.platformx.business.service.BusinessCustomerService;
import com.by4cloud.platformx.business.vo.BankNameVo;
+import com.by4cloud.platformx.business.vo.BusinessCustomerMainVo;
import com.by4cloud.platformx.business.vo.CustBankVo;
import com.by4cloud.platformx.business.vo.CustInfoVo;
import com.by4cloud.platformx.common.core.util.R;
@@ -35,11 +36,15 @@
private final BipBanklViewMapper bipBanklViewMapper;
@Override
- public R syncMainBusCus() {
- List<BusinessCustomer> bcList = baseMapper.selectList(Wrappers.<BusinessCustomer>lambdaQuery().isNull(BusinessCustomer::getCreditCode)
- .or().isNull(BusinessCustomer::getLegalPerson).or().isNull(BusinessCustomer::getLegalPerson)
- .or().isNull(BusinessCustomer::getBankName).or().isNull(BusinessCustomer::getBankAccount)
- .or().isNull(BusinessCustomer::getRegisterName));
+ public R syncMainBusCus(String compId) {
+ List<BusinessCustomer> bcList = baseMapper.selectList(Wrappers.<BusinessCustomer>lambdaQuery()
+ .eq(StrUtil.isNotEmpty(compId),BusinessCustomer::getCompId,compId)
+ .and(wrapper -> wrapper.isNull(BusinessCustomer::getCreditCode)
+ .or().isNull(BusinessCustomer::getLegalPerson)
+ .or().isNull(BusinessCustomer::getBankName)
+ .or().isNull(BusinessCustomer::getBankAccount)
+ .or().isNull(BusinessCustomer::getRegisterName))
+ );
if (ArrayUtil.isNotEmpty(bcList.toArray())){
for (BusinessCustomer bc:bcList
) {
@@ -48,21 +53,21 @@
if (ObjUtil.isNotNull(custInfo)){
bc.setCreditCode(custInfo.getCertificateId());
bc.setRegisterName(custInfo.getCustName());
- bc.setLegalPerson(custInfo.getLegalGerson());
+ bc.setLegalPerson(custInfo.getLegalPerson());
bc.setAddress(custInfo.getRegistrationAddress());
baseMapper.updateById(bc);
log.info("{}鍚屾鍚嶇О銆佹硶浜恒�佸湴鍧�銆佷俊鐢ㄧ爜淇℃伅鎴愬姛",bc.getCompanyName());
}
- CustBankVo bankVo = bipViewMapper.selectBankByCustName(bc.getCompanyName());
- if (ObjUtil.isNotNull(bankVo)){
+ List<CustBankVo> bankVoList = bipViewMapper.selectBankByCustName(bc.getCompanyName());
+ if (ArrayUtil.isNotEmpty(bankVoList.toArray())){
if (StrUtil.isEmpty(bc.getBankAccount())){
- bc.setBankAccount(bankVo.getBankAccount());
+ bc.setBankAccount(bankVoList.get(0).getBankAccount());
baseMapper.updateById(bc);
log.info("{}鍚屾閾惰鍗″彿淇℃伅鎴愬姛",bc.getCompanyName());
}
- BankNameVo bankNameVo = bipBanklViewMapper.selectBankByCode(bankVo.getBankName());
- if (ObjUtil.isNotNull(bankVo)){
- bc.setBankName(bankNameVo.getBankNameName());
+ List<BankNameVo> bankNameVoList = bipBanklViewMapper.selectBankByCode(bankVoList.get(0).getBankName());
+ if (ArrayUtil.isNotEmpty(bankNameVoList.toArray())){
+ bc.setBankName(bankNameVoList.get(0).getBankNameName());
baseMapper.updateById(bc);
log.info("{}鍚屾閾惰鍚嶇О淇℃伅鎴愬姛",bc.getCompanyName());
}
@@ -72,4 +77,32 @@
}
return R.ok();
}
+
+ @Override
+ public BusinessCustomerMainVo queryMainBC(String companyName) {
+ BusinessCustomerMainVo bc = new BusinessCustomerMainVo();
+ bc.setCompanyName(companyName);
+ log.info("涓绘暟鎹煡璇}淇℃伅",companyName);
+ CustInfoVo custInfo = bipViewMapper.selectBaseInfoByCustName(companyName);
+ if (ObjUtil.isNotNull(custInfo)){
+ bc.setCreditCode(custInfo.getCertificateId());
+ bc.setRegisterName(custInfo.getCustName());
+ bc.setLegalPerson(custInfo.getLegalPerson());
+ bc.setAddress(custInfo.getRegistrationAddress());
+ log.info("{}涓绘暟鎹煡璇㈠悕绉般�佹硶浜恒�佸湴鍧�銆佷俊鐢ㄧ爜淇℃伅鎴愬姛",companyName);
+ }
+ List<CustBankVo> bankVoList = bipViewMapper.selectBankByCustName(bc.getCompanyName());
+ if (ArrayUtil.isNotEmpty(bankVoList.toArray())){
+ if (StrUtil.isEmpty(bc.getBankAccount())){
+ bc.setBankAccount(bankVoList.get(0).getBankAccount());
+ log.info("{}涓绘暟鎹煡璇㈤摱琛屽崱鍙蜂俊鎭垚鍔�",companyName);
+ }
+ List<BankNameVo> bankNameVoList = bipBanklViewMapper.selectBankByCode(bankVoList.get(0).getBankName());
+ if (ArrayUtil.isNotEmpty(bankNameVoList.toArray())){
+ bc.setBankName(bankNameVoList.get(0).getBankNameName());
+ log.info("{}涓绘暟鎹煡璇㈤摱琛屽悕绉颁俊鎭垚鍔�",companyName);
+ }
+ }
+ return bc;
+ }
}
\ 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 5916741..9d07ded 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
@@ -21,6 +21,7 @@
import com.by4cloud.platformx.business.api.feign.RemoteFlowProcessService;
import com.by4cloud.platformx.business.constant.FlowNameEnum;
import com.by4cloud.platformx.business.dto.ContractInvoiceQueryDTO;
+import com.by4cloud.platformx.business.dto.ContractQueryDTO;
import com.by4cloud.platformx.business.dto.GenInvoiceInfoDTO;
import com.by4cloud.platformx.business.entity.*;
import com.by4cloud.platformx.business.mapper.*;
@@ -56,6 +57,10 @@
private final ContractMapper contractMapper;
private final BusinessCustomerMapper businessCustomerMapper;
private final ContractOutBoundMapper contractOutBoundMapper;
+ private final PaymentConfirmMapper paymentConfirmMapper;
+ private final ContractExecDateMapper contractExecDateMapper;
+ private final ContractPaymentScheduleMapper contractPaymentScheduleMapper;
+ private final MeterReadRecordMapper meterReadRecordMapper;
private final ContractSubjectMatterMapper subjectMatterMapper;
private final ProductMapper productMapper;
private final BwRequestRecordMapper bwRequestRecordMapper;
@@ -87,7 +92,7 @@
.selectAll(ContractOutBound.class)
.eq(ContractOutBound::getContractId, contractId);
List<ContractInvoiceOutBoundVo> invoiceOutBoundVoList = contractOutBoundMapper.selectJoinList(ContractInvoiceOutBoundVo.class, wrapper);
- if (ArrayUtil.isNotEmpty(invoiceOutBoundVoList.toArray())){
+ if (ArrayUtil.isNotEmpty(invoiceOutBoundVoList.toArray())) {
invoiceOutBoundVoList.stream().forEach(contractInvoiceOutBoundVo -> {
contractInvoiceOutBoundVo.setInvoiceNum(contractInvoiceOutBoundVo.getOutBoundNum().subtract(contractInvoiceOutBoundVo.getInvoiceNum()));
contractInvoiceOutBoundVo.setToInvoiceNum(contractInvoiceOutBoundVo.getInvoiceNum());
@@ -97,12 +102,29 @@
}
@Override
+ public R getContractHouseWater(Long contractId) {
+ MPJLambdaWrapper<ContractPaymentSchedule> wrapper = new MPJLambdaWrapper<ContractPaymentSchedule>()
+ .selectAll(ContractPaymentSchedule.class)
+ .eq(ContractPaymentSchedule::getContractId, contractId)
+ .orderByAsc(ContractPaymentSchedule::getCreateTime);
+ List<ContractHouseWaterVo> invoiceOutBoundVoList = contractPaymentScheduleMapper.selectJoinList(ContractHouseWaterVo.class, wrapper);
+ return R.ok(invoiceOutBoundVoList);
+ }
+
+ @Override
public R genInvoiceInfo(GenInvoiceInfoDTO genInvoiceInfoDTO) {
if (ArrayUtil.isEmpty(genInvoiceInfoDTO.getOutBoundInvoiceList())) {
return R.failed("璇烽�夋嫨寮�绁ㄥ嚭搴撳崟鍚庡啀鎿嶄綔");
}
- ContractOutBound outBound = contractOutBoundMapper.selectById(genInvoiceInfoDTO.getOutBoundInvoiceList().get(0).getContractOutBoundId());
- Contract contract = contractMapper.selectById(outBound.getContractId());
+ Long contractId = null;
+ if (!StrUtil.equals(genInvoiceInfoDTO.getContractCategory(),"water_house")) {
+ ContractOutBound outBound = contractOutBoundMapper.selectById(genInvoiceInfoDTO.getOutBoundInvoiceList().get(0).getContractOutBoundId());
+ contractId = outBound.getContractId();
+ }else {
+ ContractPaymentSchedule schedule = contractPaymentScheduleMapper.selectById(genInvoiceInfoDTO.getOutBoundInvoiceList().get(0).getContractOutBoundId());
+ contractId = schedule.getContractId();
+ }
+ Contract contract = contractMapper.selectById(contractId);
if (ObjUtil.isNull(contract)) {
return R.failed("鍚堝悓淇℃伅寮傚父锛岃鑱旂郴鎶�鏈汉鍛�");
}
@@ -132,57 +154,129 @@
List<ContractOutBoundMergeVo> mergeOutBounds = new ArrayList<>();
// List<ContractOutBound> outBounds = contractOutBoundMapper.selectList(Wrappers.<ContractOutBound>lambdaQuery()
// .in(ContractOutBound::getId, genInvoiceInfoDTO.getOutBoundInvoiceList().stream().map(item->item.getContractOutBoundId()).collect(Collectors.toList())));
- if (ArrayUtil.isNotEmpty(genInvoiceInfoDTO.getOutBoundInvoiceList().toArray())) {
- genInvoiceInfoDTO.getOutBoundInvoiceList().stream().forEach(contractOutBoundInvoiceVo -> {
- ContractOutBound contractOutBound = contractOutBoundMapper.selectById(contractOutBoundInvoiceVo.getContractOutBoundId());
+ if (!StrUtil.equals(contract.getContractCategory(), "water_house")){
+ if (ArrayUtil.isNotEmpty(genInvoiceInfoDTO.getOutBoundInvoiceList().toArray())) {
+ genInvoiceInfoDTO.getOutBoundInvoiceList().stream().forEach(contractOutBoundInvoiceVo -> {
+ ContractOutBound contractOutBound = contractOutBoundMapper.selectById(contractOutBoundInvoiceVo.getContractOutBoundId());
- if (!ArrayUtil.contains(erpCode.toArray(), contractOutBound.getSubjectMatterCode())) {
- erpCode.add(contractOutBound.getSubjectMatterCode());
- ContractOutBoundMergeVo mergeVo = new ContractOutBoundMergeVo();
- mergeVo.setMaterialCode(contractOutBound.getSubjectMatterCode());
- mergeVo.setMaterialInternalName(contractOutBound.getSubjectMatterName());
- mergeVo.setQuantity(contractOutBoundInvoiceVo.getInvoiceNum());
- Product product = productMapper.selectOne(Wrappers.<Product>lambdaQuery().eq(Product::getErpCode, contractOutBound.getSubjectMatterCode())
- .eq(Product::getCompId, SecurityUtils.getUser().getCompId()).last("limit 1"));
- if (ObjUtil.isNotNull(product)) {
- mergeVo.setTaxClass(product.getTaxClass());
- mergeVo.setSpecification(product.getProductType());
- mergeVo.setTaxRate(new BigDecimal(product.getTaxRate()));
- mergeVo.setTaxCode(product.getTaxCode());
- Product productClass = productMapper.selectById(product.getParentId());
+ if (!ArrayUtil.contains(erpCode.toArray(), contractOutBound.getSubjectMatterCode())) {
+ erpCode.add(contractOutBound.getSubjectMatterCode());
+ ContractOutBoundMergeVo mergeVo = new ContractOutBoundMergeVo();
+ mergeVo.setMaterialCode(contractOutBound.getSubjectMatterCode());
+ mergeVo.setMaterialInternalName(contractOutBound.getSubjectMatterName());
+ mergeVo.setQuantity(contractOutBoundInvoiceVo.getInvoiceNum());
+ Product product = productMapper.selectOne(Wrappers.<Product>lambdaQuery().eq(Product::getErpCode, contractOutBound.getSubjectMatterCode())
+ .eq(Product::getCompId, SecurityUtils.getUser().getCompId()).last("limit 1"));
if (ObjUtil.isNotNull(product)) {
- mergeVo.setItemName("*" + product.getTaxClass() + "*" + productClass.getProductName());
+ mergeVo.setTaxClass(product.getTaxClass());
+ mergeVo.setSpecification(product.getProductType());
+ mergeVo.setTaxRate(new BigDecimal(product.getTaxRate()));
+ mergeVo.setTaxCode(product.getTaxCode());
+ Product productClass = productMapper.selectById(product.getParentId());
+ if (ObjUtil.isNotNull(product)) {
+ if (StrUtil.equals(product.getErpCode(), "water_bill")) {
+ mergeVo.setItemName("*" + product.getTaxClass() + "*姘磋垂");
+ } else if (StrUtil.equals(product.getErpCode(), "electricity_bill")) {
+ mergeVo.setItemName("*" + product.getTaxClass() + "*鐢佃垂");
+ } else if (StrUtil.equals(product.getErpCode(), "house_rental")) {
+ mergeVo.setItemName("*" + product.getTaxClass() + "*鎴垮眿绉熻祦");
+ } else {
+ mergeVo.setItemName("*" + product.getTaxClass() + "*" + productClass.getProductName());
+ }
+
+ }
+ }
+ ContractSubjectMatter subjectMatter = subjectMatterMapper.selectOne(Wrappers.<ContractSubjectMatter>lambdaQuery()
+ .eq(ContractSubjectMatter::getMaterialCode, contractOutBound.getSubjectMatterCode())
+ .eq(ContractSubjectMatter::getContractId, contract.getId()).last("limit 1"));
+ if (ObjUtil.isNotNull(subjectMatter)) {
+ mergeVo.setUnitPrice(subjectMatter.getUnitPrice());
+ mergeVo.setUnit(subjectMatter.getUnit());
+ }
+ mergeOutBounds.add(mergeVo);
+ } else {
+ List<ContractOutBoundMergeVo> filteredList = mergeOutBounds.stream()
+ .filter(item -> contractOutBound.getSubjectMatterCode().equals(item.getMaterialCode())) // 闃叉绌烘寚閽堬紝寤鸿甯搁噺鍦ㄥ墠
+ .collect(Collectors.toList());
+ if (ArrayUtil.isNotEmpty(filteredList.toArray())) {
+ filteredList.get(0).setQuantity(filteredList.get(0).getQuantity().add(contractOutBound.getOutBoundNum()));
}
}
- ContractSubjectMatter subjectMatter = subjectMatterMapper.selectOne(Wrappers.<ContractSubjectMatter>lambdaQuery()
- .eq(ContractSubjectMatter::getMaterialCode, contractOutBound.getSubjectMatterCode())
- .eq(ContractSubjectMatter::getContractId, contract.getId()).last("limit 1"));
- if (ObjUtil.isNotNull(subjectMatter)) {
- mergeVo.setUnitPrice(subjectMatter.getUnitPrice());
- mergeVo.setUnit(subjectMatter.getUnit());
- }
- mergeOutBounds.add(mergeVo);
- } else {
- List<ContractOutBoundMergeVo> filteredList = mergeOutBounds.stream()
- .filter(item -> contractOutBound.getSubjectMatterCode().equals(item.getMaterialCode())) // 闃叉绌烘寚閽堬紝寤鸿甯搁噺鍦ㄥ墠
- .collect(Collectors.toList());
- if (ArrayUtil.isNotEmpty(filteredList.toArray())) {
- filteredList.get(0).setQuantity(filteredList.get(0).getQuantity().add(contractOutBound.getOutBoundNum()));
- }
- }
- });
- if (ArrayUtil.isNotEmpty(mergeOutBounds.toArray())) {
- invoiceItemVoList = BeanUtil.copyToList(mergeOutBounds, InvoiceItemVo.class);
- invoiceItemVoList.stream().forEach(invoiceItemVo -> {
-// for (InvoiceItemVo invoiceItemVo:invoiceItemVoList) {
- BigDecimal itemPrice = invoiceItemVo.getUnitPrice().multiply(invoiceItemVo.getQuantity());
- BigDecimal itemPriceTax = itemPrice.divide(new BigDecimal("100").add(invoiceItemVo.getTaxRate()), 2, RoundingMode.HALF_UP).multiply(invoiceItemVo.getTaxRate());
- invoiceItemVo.setPriceTax(itemPriceTax);
- invoiceItemVo.setPriceNoTax(itemPrice.subtract(itemPriceTax));
});
- vo.setTotalPrice(invoiceItemVoList.stream().map(item -> item.getPriceTax().add(item.getPriceNoTax())).reduce(BigDecimal.ZERO, BigDecimal::add));
- vo.setInvoiceItemList(invoiceItemVoList);
- vo.setPriceWords(Convert.digitToChinese(vo.getTotalPrice()));
+ if (ArrayUtil.isNotEmpty(mergeOutBounds.toArray())) {
+ invoiceItemVoList = BeanUtil.copyToList(mergeOutBounds, InvoiceItemVo.class);
+ invoiceItemVoList.stream().forEach(invoiceItemVo -> {
+// for (InvoiceItemVo invoiceItemVo:invoiceItemVoList) {
+ BigDecimal itemPrice = invoiceItemVo.getUnitPrice().multiply(invoiceItemVo.getQuantity());
+ BigDecimal itemPriceTax = itemPrice.divide(new BigDecimal("100").add(invoiceItemVo.getTaxRate()), 2, RoundingMode.HALF_UP).multiply(invoiceItemVo.getTaxRate());
+ invoiceItemVo.setPriceTax(itemPriceTax);
+ invoiceItemVo.setPriceNoTax(itemPrice.subtract(itemPriceTax));
+ });
+ vo.setTotalPrice(invoiceItemVoList.stream().map(item -> item.getPriceTax().add(item.getPriceNoTax())).reduce(BigDecimal.ZERO, BigDecimal::add));
+ vo.setInvoiceItemList(invoiceItemVoList);
+ vo.setPriceWords(Convert.digitToChinese(vo.getTotalPrice()));
+ }
+ }
+ }else {
+ if (ArrayUtil.isNotEmpty(genInvoiceInfoDTO.getOutBoundInvoiceList().toArray())) {
+ genInvoiceInfoDTO.getOutBoundInvoiceList().stream().forEach(contractOutBoundInvoiceVo -> {
+ ContractPaymentSchedule schedule = contractPaymentScheduleMapper.selectById(contractOutBoundInvoiceVo.getContractOutBoundId());
+
+ if (!ArrayUtil.contains(erpCode.toArray(), schedule.getSubjectMatterCode())) {
+ erpCode.add(schedule.getSubjectMatterCode());
+ ContractOutBoundMergeVo mergeVo = new ContractOutBoundMergeVo();
+ mergeVo.setMaterialCode(schedule.getSubjectMatterCode());
+ mergeVo.setMaterialInternalName(schedule.getSubjectMatterName());
+ mergeVo.setPriceAndTax(schedule.getPlannedAmount());
+ Product product = productMapper.selectOne(Wrappers.<Product>lambdaQuery().eq(Product::getErpCode, schedule.getSubjectMatterCode())
+ .eq(Product::getCompId, SecurityUtils.getUser().getCompId()).last("limit 1"));
+ if (ObjUtil.isNotNull(product)) {
+ mergeVo.setTaxClass(product.getTaxClass());
+ mergeVo.setSpecification(product.getProductType());
+ mergeVo.setTaxRate(new BigDecimal(product.getTaxRate()));
+ mergeVo.setTaxCode(product.getTaxCode());
+ Product productClass = productMapper.selectById(product.getParentId());
+ if (ObjUtil.isNotNull(product)) {
+ if (StrUtil.equals(product.getErpCode(), "water_bill")) {
+ mergeVo.setItemName("*" + product.getTaxClass() + "*姘磋垂");
+ } else if (StrUtil.equals(product.getErpCode(), "electricity_bill")) {
+ mergeVo.setItemName("*" + product.getTaxClass() + "*鐢佃垂");
+ } else if (StrUtil.equals(product.getErpCode(), "house_rental")) {
+ mergeVo.setItemName("*" + product.getTaxClass() + "*鎴垮眿绉熻祦");
+ } else {
+ mergeVo.setItemName("*" + product.getTaxClass() + "*" + productClass.getProductName());
+ }
+
+ }
+ }
+ ContractSubjectMatter subjectMatter = subjectMatterMapper.selectOne(Wrappers.<ContractSubjectMatter>lambdaQuery()
+ .eq(ContractSubjectMatter::getMaterialCode, schedule.getSubjectMatterCode())
+ .eq(ContractSubjectMatter::getContractId, contract.getId()).last("limit 1"));
+ if (ObjUtil.isNotNull(subjectMatter)) {
+ mergeVo.setUnitPrice(subjectMatter.getUnitPrice());
+ }
+ mergeOutBounds.add(mergeVo);
+ }else {
+ List<ContractOutBoundMergeVo> filterMergeVo = mergeOutBounds.stream().filter(item->item.getMaterialCode()
+ .equals(schedule.getSubjectMatterCode())).collect(Collectors.toList());
+ if (ArrayUtil.isNotEmpty(filterMergeVo.toArray())){
+ filterMergeVo.get(0).setPriceAndTax(schedule.getPlannedAmount().add(filterMergeVo.get(0).getPriceAndTax()));
+ }
+ }
+ });
+ if (ArrayUtil.isNotEmpty(mergeOutBounds.toArray())) {
+ invoiceItemVoList = BeanUtil.copyToList(mergeOutBounds, InvoiceItemVo.class);
+ invoiceItemVoList.stream().forEach(invoiceItemVo -> {
+// for (InvoiceItemVo invoiceItemVo:invoiceItemVoList) {
+ BigDecimal itemPrice = invoiceItemVo.getPriceAndTax();
+ BigDecimal itemPriceTax = itemPrice.divide(new BigDecimal("100").add(invoiceItemVo.getTaxRate()), 2, RoundingMode.HALF_UP).multiply(invoiceItemVo.getTaxRate());
+ invoiceItemVo.setPriceTax(itemPriceTax);
+ invoiceItemVo.setPriceNoTax(itemPrice.subtract(itemPriceTax));
+ });
+ vo.setTotalPrice(invoiceItemVoList.stream().map(item -> item.getPriceAndTax()).reduce(BigDecimal.ZERO, BigDecimal::add));
+ vo.setInvoiceItemList(invoiceItemVoList);
+ vo.setPriceWords(Convert.digitToChinese(vo.getTotalPrice()));
+ }
}
}
return vo;
@@ -193,8 +287,15 @@
if (ArrayUtil.isEmpty(genInvoiceInfoDTO.getOutBoundInvoiceList().toArray())) {
return R.failed("璇烽�夋嫨寮�绁ㄥ嚭搴撳崟鍚庡啀鎿嶄綔");
}
- ContractOutBound outBound = contractOutBoundMapper.selectById(genInvoiceInfoDTO.getOutBoundInvoiceList().get(0).getContractOutBoundId());
- Contract contract = contractMapper.selectById(outBound.getContractId());
+ Long contractId = null;
+ if (!StrUtil.equals(genInvoiceInfoDTO.getContractCategory(),"water_house")) {
+ ContractOutBound outBound = contractOutBoundMapper.selectById(genInvoiceInfoDTO.getOutBoundInvoiceList().get(0).getContractOutBoundId());
+ contractId = outBound.getContractId();
+ }else {
+ ContractPaymentSchedule schedule = contractPaymentScheduleMapper.selectById(genInvoiceInfoDTO.getOutBoundInvoiceList().get(0).getContractOutBoundId());
+ contractId = schedule.getContractId();
+ }
+ Contract contract = contractMapper.selectById(contractId);
if (ObjUtil.isNull(contract)) {
return R.failed("鍚堝悓淇℃伅寮傚父锛岃鑱旂郴鎶�鏈汉鍛�");
}
@@ -209,19 +310,31 @@
//鍚姩娴佺▼
ProcessInstanceParamDto dto = new ProcessInstanceParamDto();
Map<String, Object> map = BeanUtil.beanToMap(invoice);
+ if (StrUtil.equals(genInvoiceInfoDTO.getContractCategory(),"water_house")) {
+ map.put("contractCategory","water_house");
+ }
dto.setParamMap(map);
dto.setFlowName(FlowNameEnum.閿�鍞寕璐﹀鎵�.name());
R r1 = remoteFlowProcessService.startProcessInstance(dto);
if (r1.getCode() == 1) {
return R.failed("娴佺▼鍚姩澶辫触");
}
- //鏇存柊鍚堝悓鍑哄簱鍗曠姸鎬�
- genInvoiceInfoDTO.getOutBoundInvoiceList().stream().forEach(contractOutBoundInvoiceVo -> {
- ContractOutBound bound = contractOutBoundMapper.selectById(contractOutBoundInvoiceVo.getContractOutBoundId());
- bound.setInvoiceStatus("1");
- bound.setInvoiceNum(bound.getInvoiceNum().add(contractOutBoundInvoiceVo.getInvoiceNum()));
- contractOutBoundMapper.updateById(bound);
- });
+ 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);
+ });
+ }else {
+ //鏇存柊鍚堝悓鎴跨 姘寸數 璐瑰紑绁ㄧ姸鎬�
+ genInvoiceInfoDTO.getOutBoundInvoiceList().stream().forEach(contractOutBoundInvoiceVo -> {
+ ContractPaymentSchedule schedule = contractPaymentScheduleMapper.selectById(contractOutBoundInvoiceVo.getContractOutBoundId());
+ schedule.setInvoiceFlag("1");
+ contractPaymentScheduleMapper.updateById(schedule);
+ });
+ }
return R.ok();
}
@@ -259,7 +372,11 @@
invoiceDetail.put("goodsUnit", invoiceItemVo.getUnit());
invoiceDetail.put("goodsQuantity", invoiceItemVo.getQuantity());
invoiceDetail.put("goodsPrice", invoiceItemVo.getUnitPrice());
- invoiceDetail.put("goodsTotalPrice", invoiceItemVo.getUnitPrice().multiply(invoiceItemVo.getQuantity()));
+ if (!StrUtil.equals(vo.getContractCategory(),"water_house")) {
+ invoiceDetail.put("goodsTotalPrice", invoiceItemVo.getUnitPrice().multiply(invoiceItemVo.getQuantity()));
+ }else {
+ invoiceDetail.put("goodsTotalPrice", invoiceItemVo.getPriceAndTax());
+ }
invoiceDetail.put("goodsTotalTax", invoiceItemVo.getPriceTax());
invoiceDetailsList.add(invoiceDetail);
@@ -316,6 +433,7 @@
ContractInvoice blueInvoice = baseMapper.selectById(invoiceId);
blueInvoice.setRedReversal("2");
baseMapper.updateById(blueInvoice);
+ Contract contract = contractMapper.selectById(blueInvoice.getContractId());
ContractInvoice invoice = new ContractInvoice();
invoice.setContractId(blueInvoice.getContractId());
invoice.setTexNo(blueInvoice.getTexNo());
@@ -342,6 +460,10 @@
ProcessInstanceParamDto dto = new ProcessInstanceParamDto();
Map<String, Object> map = BeanUtil.beanToMap(invoice);
dto.setParamMap(map);
+ if (StrUtil.equals(contract.getContractCategory(),"water_house")) {
+ map.put("contractCategory","water_house");
+ }
+ dto.setParamMap(map);
dto.setFlowName(FlowNameEnum.閿�鍞寕璐﹀鎵�.name());
R r1 = remoteFlowProcessService.startProcessInstance(dto);
if (r1.getCode() == 1) {
@@ -351,7 +473,7 @@
return R.ok();
}
- private JSONObject genRedInvoice(ContractInvoice blueInvoice, String redConfirmSerialNo) {
+ private JSONObject genRedInvoice(Contract contract,ContractInvoice blueInvoice, String redConfirmSerialNo) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("taxNo", blueInvoice.getTexNo());
jsonObject.put("redConfirmSerialNo", redConfirmSerialNo);
@@ -380,7 +502,11 @@
invoiceDetail.put("goodsUnit", invoiceItemVo.getUnit());
invoiceDetail.put("goodsQuantity", invoiceItemVo.getQuantity());
invoiceDetail.put("goodsPrice", invoiceItemVo.getUnitPrice());
- invoiceDetail.put("goodsTotalPrice", invoiceItemVo.getUnitPrice().multiply(invoiceItemVo.getQuantity()));
+ if (!StrUtil.equals(contract.getContractCategory(),"water_house")) {
+ invoiceDetail.put("goodsTotalPrice", invoiceItemVo.getUnitPrice().multiply(invoiceItemVo.getQuantity()));
+ }else {
+ invoiceDetail.put("goodsTotalPrice", invoiceItemVo.getPriceAndTax());
+ }
invoiceDetail.put("goodsTotalTax", invoiceItemVo.getPriceTax());
invoiceDetailsList.add(invoiceDetail);
@@ -549,7 +675,7 @@
ContractInvoice invoice = baseMapper.selectById(id);
Contract contract = contractMapper.selectById(invoice.getContractId());
GenInvoiceInfoVo vo = BeanUtil.copyProperties(JSONObject.parseObject(invoice.getInvoicePreview()), GenInvoiceInfoVo.class);
-
+ vo.setContractCategory(contract.getContractCategory());
//钃濈エ
if (invoice.getInvoiceCategory().equals("1")) {
// TODO 寮�钃濈エ鎺ュ彛
@@ -572,37 +698,77 @@
invoice.setInvoiceNo(model.getString("invoiceNo"));
}
}
+ 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);
+ }
+ } else {
+ if (ObjUtil.isNull(contract.getBillingAmout())) {
+ contract.setBillingAmout(vo.getTotalPrice());
+ contractMapper.updateById(contract);
+ } else {
+ contract.setBillingAmout(vo.getTotalPrice().add(contract.getBillingAmout()));
+ contractMapper.updateById(contract);
+ }
+ }
+ }else {
+ //鍒ゆ柇 寰幆鏄惁瀹屾垚
+ List<ContractExecDate> execDateList = contractExecDateMapper.selectList(Wrappers.<ContractExecDate>lambdaQuery().eq(ContractExecDate::getContractId,contract.getId())
+ .eq(ContractExecDate::getGenFlag,"0"));
+ List<MeterReadRecord> recordList = meterReadRecordMapper.selectList(Wrappers.<MeterReadRecord>lambdaQuery()
+ .eq(MeterReadRecord::getContractId,contract.getId())
+ .isNull(MeterReadRecord::getMeterReadNum));
+ if (ArrayUtil.isEmpty(execDateList.toArray())&&ArrayUtil.isEmpty(recordList.toArray())) {
+ //鍒ゆ柇鏄惁鏈夊彲寮�绁ㄨ褰�
+ List<ContractPaymentSchedule> scheduleList = contractPaymentScheduleMapper.selectList(Wrappers.<ContractPaymentSchedule>lambdaQuery()
+ .eq(ContractPaymentSchedule::getContractId,contract.getId()).eq(ContractPaymentSchedule::getInvoiceFlag,"0"));
+ if (ArrayUtil.isEmpty(scheduleList.toArray())){
+ contract.setBillingStatus("3");
+ }else {
+ contract.setBillingStatus("2");
+ }
- //鍚堝悓鐘舵��
- if (StrUtil.equals(contract.getBillingStatus(), "2")) {
+ }else {
+ //鍒ゆ柇鏄惁鏈夊彲寮�绁ㄨ褰�
+ List<ContractPaymentSchedule> scheduleList = contractPaymentScheduleMapper.selectList(Wrappers.<ContractPaymentSchedule>lambdaQuery()
+ .eq(ContractPaymentSchedule::getContractId,contract.getId()));
+ if (ArrayUtil.isEmpty(scheduleList.toArray())){
+ contract.setBillingStatus("1");
+ }else {
+ contract.setBillingStatus("2");
+ }
+ }
if (ObjUtil.isNull(contract.getBillingAmout())) {
contract.setBillingAmout(vo.getTotalPrice());
- if (contract.getBillingAmout().compareTo(contract.getAmount()) == 0) {
- contract.setBillingStatus("3");
- }
- contractMapper.updateById(contract);
} else {
contract.setBillingAmout(vo.getTotalPrice().add(contract.getBillingAmout()));
- if (contract.getBillingAmout().compareTo(contract.getAmount()) == 0) {
- contract.setBillingStatus("3");
- }
- contractMapper.updateById(contract);
}
- } else {
- if (ObjUtil.isNull(contract.getBillingAmout())) {
- contract.setBillingAmout(vo.getTotalPrice());
- contractMapper.updateById(contract);
- } else {
- contract.setBillingAmout(vo.getTotalPrice().add(contract.getBillingAmout()));
- contractMapper.updateById(contract);
- }
+ contractMapper.updateById(contract);
}
}
//绾㈢エ
if (invoice.getInvoiceCategory().equals("2")) {
// TODO 寮�绾㈢エ鎺ュ彛
ContractInvoice blueInvoice = baseMapper.selectById(invoice.getBlueInvoiceId());
- JSONObject request = genRedInvoice(blueInvoice, invoice.getSerialNo());
+ JSONObject request = genRedInvoice(contract,blueInvoice, invoice.getSerialNo());
String requestId = IdUtil.fastUUID();
if (bwFlag) {
log.info("绾㈠瓧纭鍗曡姹傛帴鍙e叆鍙�", request.toJSONString());
@@ -629,23 +795,32 @@
}
}
}
+ contract.setBillingAmout(contract.getBillingAmout().subtract(invoice.getInvoiceTotalPriceTax()));
//鏇存柊鍚堝悓寮�绁ㄧ姸鎬� 鍓嶆彁鍑哄簱瀹屾垚
- if (StrUtil.equals(contract.getBillingStatus(),"3")) {
- contract.setBillingStatus("2");
- contract.setBillingAmout(contract.getBillingAmout().subtract(invoice.getInvoiceTotalPriceTax()));
- contractMapper.updateById(contract);
- }
+ contract.setBillingStatus("2");
+ contractMapper.updateById(contract);
blueInvoice.setRedReversal("1");
baseMapper.updateById(blueInvoice);
-
- //鏇存柊鍚堝悓鍑哄簱鍗曠姸鎬�
- List<ContractOutBoundInvoiceVo> outBoundInvoiceVoList = BeanUtil.copyToList(JSONArray.parseArray(blueInvoice.getInvoicePreviewParam()),ContractOutBoundInvoiceVo.class);
- 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 (!StrUtil.equals(contract.getContractCategory(),"water_house")) {
+ //鏇存柊鍚堝悓鍑哄簱鍗曠姸鎬�
+ List<ContractOutBoundInvoiceVo> outBoundInvoiceVoList = BeanUtil.copyToList(JSONArray.parseArray(blueInvoice.getInvoicePreviewParam()), ContractOutBoundInvoiceVo.class);
+ 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);
+ });
+ }
+ }else {
+ //鏇存柊鍚堝悓鎴跨 姘寸數 璐瑰紑绁ㄧ姸鎬�
+ List<ContractOutBoundInvoiceVo> outBoundInvoiceVoList = BeanUtil.copyToList(JSONArray.parseArray(blueInvoice.getInvoicePreviewParam()), ContractOutBoundInvoiceVo.class);
+ if (ArrayUtil.isNotEmpty(outBoundInvoiceVoList.toArray())) {
+ outBoundInvoiceVoList.stream().forEach(contractOutBoundInvoiceVo -> {
+ ContractPaymentSchedule schedule = contractPaymentScheduleMapper.selectById(contractOutBoundInvoiceVo.getContractOutBoundId());
+ schedule.setInvoiceFlag("0");
+ contractPaymentScheduleMapper.updateById(schedule);
+ });
+ }
}
}
invoice.setApprovalStatus("1");
@@ -657,16 +832,31 @@
ContractInvoice invoice = baseMapper.selectById(id);
invoice.setApprovalStatus("2");
baseMapper.updateById(invoice);
+ Contract contract = contractMapper.selectById(invoice.getContractId());
//钃濈エ
if (invoice.getInvoiceCategory().equals("1")) {
- //鏇存柊鍚堝悓鍑哄簱鍗曠姸鎬�
- List<ContractOutBoundInvoiceVo> outBoundInvoiceVoList = BeanUtil.copyToList(JSONArray.parseArray(invoice.getInvoicePreviewParam()),ContractOutBoundInvoiceVo.class);
- 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 (!StrUtil.equals(contract.getContractCategory(),"water_house")) {
+ //鏇存柊鍚堝悓鍑哄簱鍗曠姸鎬�
+ List<ContractOutBoundInvoiceVo> outBoundInvoiceVoList = BeanUtil.copyToList(JSONArray.parseArray(invoice.getInvoicePreviewParam()), ContractOutBoundInvoiceVo.class);
+ 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);
+ });
+ }
+ }else {
+ //鏇存柊鍚堝悓鎴跨 姘寸數 璐瑰紑绁ㄧ姸鎬�
+ List<ContractOutBoundInvoiceVo> outBoundInvoiceVoList = BeanUtil.copyToList(JSONArray.parseArray(invoice.getInvoicePreviewParam()), ContractOutBoundInvoiceVo.class);
+ if (ArrayUtil.isNotEmpty(outBoundInvoiceVoList.toArray())) {
+ outBoundInvoiceVoList.stream().forEach(contractOutBoundInvoiceVo -> {
+ ContractPaymentSchedule schedule = contractPaymentScheduleMapper.selectById(contractOutBoundInvoiceVo.getContractOutBoundId());
+ schedule.setInvoiceFlag("0");
+ contractPaymentScheduleMapper.updateById(schedule);
+ });
+ }
+ contract.setBillingStatus("2");
+ contractMapper.updateById(contract);
}
}
//绾㈢エ
@@ -681,4 +871,9 @@
public Page pageInvoice(Page page, ContractInvoiceQueryDTO queryDTO) {
return baseMapper.pageInvoice(page,queryDTO, DataScope.of("comp_id"));
}
+
+ @Override
+ public Page pageScope(Page page, ContractQueryDTO queryDTO) {
+ return baseMapper.pageScope(page,queryDTO, DataScope.of("comp_id"));
+ }
}
diff --git a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/ContractPaymentScheduleProcessServiceImpl.java b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/ContractPaymentScheduleProcessServiceImpl.java
index 817cc74..d653e4e 100644
--- a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/ContractPaymentScheduleProcessServiceImpl.java
+++ b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/ContractPaymentScheduleProcessServiceImpl.java
@@ -255,7 +255,7 @@
}
}
}
- } else {
+ } else if (schedule.getStageName().equals("璋冭瘯瀹屾垚鎴栭獙鏀�")){
//鏂板褰撳墠闃舵搴旀敹
PaymentConfirm currentConfim = new PaymentConfirm();
currentConfim.setBusinessType(schedule.getStageName() + "搴旀敹");
@@ -294,52 +294,53 @@
//鏌ヨ鏄惁鏈夊悗缁樁娈�
List<ContractPaymentSchedule> afterSchedule = contractPaymentScheduleMapper.selectList(Wrappers.<ContractPaymentSchedule>lambdaQuery()
.eq(ContractPaymentSchedule::getContractId, schedule.getContractId())
- .gt(ContractPaymentSchedule::getStageOrder, schedule.getStageOrder()));
+ .gt(ContractPaymentSchedule::getStageOrder, schedule.getStageOrder())
+ .gt(ContractPaymentSchedule::getPaymentRatio,"0"));
if (ArrayUtil.isNotEmpty(afterSchedule.toArray()) && afterSchedule.size() == 1) {
//鏈�鍚庨樁娈电敓鏁堟椂闂�
ContractPaymentSchedule endSchedule = afterSchedule.get(0);
- if (StrUtil.equals(endSchedule.getStageName(), "璐ㄤ繚閲�")) {
- endSchedule.setEffectiveEndDate(DateUtil.offsetDay(addDTO.getProcessDate(), endSchedule.getAgreedDays()));
- contractPaymentScheduleMapper.updateById(endSchedule);
- //褰撳墠闃舵鐢熸晥鏃堕棿
- schedule.setEffectiveEndDate(DateUtil.offsetDay(addDTO.getProcessDate(), schedule.getAgreedDays()));
- contractPaymentScheduleMapper.updateById(schedule);
- //鏈�鍚庨樁娈靛簲鏀�
- PaymentConfirm newConfim = new PaymentConfirm();
- newConfim.setBusinessType(endSchedule.getStageName() + "搴旀敹");
- newConfim.setBusGuestId(contract.getPartyAId());
- newConfim.setBusGuestName(contract.getPartyA());
- newConfim.setContractId(contract.getId());
- newConfim.setContractName(contract.getContractName());
- newConfim.setContractNo(contract.getContractNo());
- newConfim.setScheduleId(endSchedule.getId());
- newConfim.setScheduleName(schedule.getStageName());
- newConfim.setConfirmTime(addDTO.getProcessDate());
- newConfim.setTransationAmount(endSchedule.getPlannedAmount());
- newConfim.setReceivableAmount(endSchedule.getPlannedAmount());
- PaymentConfirm lastNewConfirm = paymentConfirmMapper.selectOne(Wrappers.<PaymentConfirm>lambdaQuery().eq(PaymentConfirm::getContractId, contract.getId())
- .orderByDesc(PaymentConfirm::getCreateTime).last("limit 1"));
- BigDecimal lastNewTotal = new BigDecimal("0");
- if (ObjUtil.isNotNull(lastNewConfirm)) {
- lastNewTotal = lastNewConfirm.getTotalAmount();
- }
- newConfim.setTotalAmount(lastNewTotal.subtract(newConfim.getReceivableAmount()));
- if (endSchedule.getPaymentRatio().compareTo(new BigDecimal("0")) > 0) {
- paymentConfirmMapper.insert(newConfim);
- //鏇存柊褰撳墠闃舵浠樻鎯呭喌
- if (lastNewTotal.compareTo(new BigDecimal("0"))>0){
- if (newConfim.getTotalAmount().compareTo(new BigDecimal("0"))>=0) {
- schedule.setPaymentStatus(2);
- schedule.setPlannedAmount(schedule.getPlannedAmount());
- contractPaymentScheduleMapper.updateById(schedule);
- }else {
- schedule.setPaymentStatus(1);
- schedule.setPlannedAmount(lastNewTotal);
- }
- }
- }
-
- }
+// if (StrUtil.equals(endSchedule.getStageName(), "璐ㄤ繚閲�")) {
+// endSchedule.setEffectiveEndDate(DateUtil.offsetDay(addDTO.getProcessDate(), endSchedule.getAgreedDays()));
+// contractPaymentScheduleMapper.updateById(endSchedule);
+// //褰撳墠闃舵鐢熸晥鏃堕棿
+// schedule.setEffectiveEndDate(DateUtil.offsetDay(addDTO.getProcessDate(), schedule.getAgreedDays()));
+// contractPaymentScheduleMapper.updateById(schedule);
+// //鏈�鍚庨樁娈靛簲鏀�
+// PaymentConfirm newConfim = new PaymentConfirm();
+// newConfim.setBusinessType(endSchedule.getStageName() + "搴旀敹");
+// newConfim.setBusGuestId(contract.getPartyAId());
+// newConfim.setBusGuestName(contract.getPartyA());
+// newConfim.setContractId(contract.getId());
+// newConfim.setContractName(contract.getContractName());
+// newConfim.setContractNo(contract.getContractNo());
+// newConfim.setScheduleId(endSchedule.getId());
+// newConfim.setScheduleName(schedule.getStageName());
+// newConfim.setConfirmTime(addDTO.getProcessDate());
+// newConfim.setTransationAmount(endSchedule.getPlannedAmount());
+// newConfim.setReceivableAmount(endSchedule.getPlannedAmount());
+// PaymentConfirm lastNewConfirm = paymentConfirmMapper.selectOne(Wrappers.<PaymentConfirm>lambdaQuery().eq(PaymentConfirm::getContractId, contract.getId())
+// .orderByDesc(PaymentConfirm::getCreateTime).last("limit 1"));
+// BigDecimal lastNewTotal = new BigDecimal("0");
+// if (ObjUtil.isNotNull(lastNewConfirm)) {
+// lastNewTotal = lastNewConfirm.getTotalAmount();
+// }
+// newConfim.setTotalAmount(lastNewTotal.subtract(newConfim.getReceivableAmount()));
+// if (endSchedule.getPaymentRatio().compareTo(new BigDecimal("0")) > 0) {
+// paymentConfirmMapper.insert(newConfim);
+// //鏇存柊褰撳墠闃舵浠樻鎯呭喌
+// if (lastNewTotal.compareTo(new BigDecimal("0"))>0){
+// if (newConfim.getTotalAmount().compareTo(new BigDecimal("0"))>=0) {
+// schedule.setPaymentStatus(2);
+// schedule.setPlannedAmount(schedule.getPlannedAmount());
+// contractPaymentScheduleMapper.updateById(schedule);
+// }else {
+// schedule.setPaymentStatus(1);
+// schedule.setPlannedAmount(lastNewTotal);
+// }
+// }
+// }
+//
+// }
//鏇存柊鍚堝悓涓嬩釜闃舵
contract.setNextScheduleName(endSchedule.getStageName());
contractMapper.updateById(contract);
@@ -364,6 +365,45 @@
contractMapper.updateById(contract);
}
}
+ }else {
+
+ //鏈�鍚庨樁娈靛簲鏀�
+ PaymentConfirm newConfim = new PaymentConfirm();
+ newConfim.setBusinessType(schedule.getStageName() + "搴旀敹");
+ newConfim.setBusGuestId(contract.getPartyAId());
+ newConfim.setBusGuestName(contract.getPartyA());
+ newConfim.setContractId(contract.getId());
+ newConfim.setContractName(contract.getContractName());
+ newConfim.setContractNo(contract.getContractNo());
+ newConfim.setScheduleId(schedule.getId());
+ newConfim.setScheduleName(schedule.getStageName());
+ newConfim.setConfirmTime(addDTO.getProcessDate());
+ newConfim.setTransationAmount(schedule.getPlannedAmount());
+ newConfim.setReceivableAmount(schedule.getPlannedAmount());
+ PaymentConfirm lastNewConfirm = paymentConfirmMapper.selectOne(Wrappers.<PaymentConfirm>lambdaQuery().eq(PaymentConfirm::getContractId, contract.getId())
+ .orderByDesc(PaymentConfirm::getCreateTime).last("limit 1"));
+ BigDecimal lastNewTotal = new BigDecimal("0");
+ if (ObjUtil.isNotNull(lastNewConfirm)) {
+ lastNewTotal = lastNewConfirm.getTotalAmount();
+ }
+ newConfim.setTotalAmount(lastNewTotal.subtract(newConfim.getReceivableAmount()));
+ if (schedule.getPaymentRatio().compareTo(new BigDecimal("0")) > 0) {
+ paymentConfirmMapper.insert(newConfim);
+ //鏇存柊褰撳墠闃舵浠樻鎯呭喌
+ if (lastNewTotal.compareTo(new BigDecimal("0"))>0){
+ if (newConfim.getTotalAmount().compareTo(new BigDecimal("0"))>=0) {
+ schedule.setPaymentStatus(2);
+ schedule.setPlannedAmount(schedule.getPlannedAmount());
+ }else {
+ schedule.setPaymentStatus(1);
+ schedule.setPlannedAmount(lastNewTotal);
+ }
+ contractPaymentScheduleMapper.updateById(schedule);
+ }
+ }
+ //鏇存柊鍚堝悓涓嬩釜闃舵
+ contract.setNextScheduleName("");
+ contractMapper.updateById(contract);
}
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 b0c589d..437d9ca 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
@@ -25,6 +25,9 @@
import com.by4cloud.platformx.business.service.ContractService;
import com.by4cloud.platformx.business.utils.ItemGeneratorUtil;
import com.by4cloud.platformx.business.vo.ContractDetailVo;
+import com.by4cloud.platformx.business.vo.ContractInvoiceVo;
+import com.by4cloud.platformx.business.vo.ContractSlipVo;
+import com.by4cloud.platformx.business.vo.FourAssociationPageVo;
import com.by4cloud.platformx.common.core.util.R;
import com.by4cloud.platformx.common.data.datascope.DataScope;
import com.by4cloud.platformx.common.security.util.SecurityUtils;
@@ -73,13 +76,12 @@
private final RemoteDeptService remoteDeptService;
private final ContractDelayOutMapper contractDelayOutMapper;
private final ErpRequestRecordMapper erpRequestRecordMapper;
+ private final PaymentSlipMapper paymentSlipMapper;
+ private final ContractInvoiceMapper contractInvoiceMapper;
private final StringRedisTemplate redisTemplate;
@Value("${erp.ymj}")
private String ymjErp;
-
- @Value("${erp.ymjToken}")
- private String ymjToken;
@Value("${erp.smj}")
private String smjErp;
@@ -118,17 +120,29 @@
if (ObjUtil.isNotNull(bc)){
contract.setPartyA(bc.getCompanyName());
}
+ if (!StrUtil.equals(SecurityUtils.getUser().getCompId()+"",sgb)&&StrUtil.isEmpty(bc.getErpCompanyCode())){
+ return R.failed("璇峰畬鍠勫鎴稥RP缂栫爜");
+ }
}
contract.setPaidAmount(new BigDecimal("0"));
- contract.setBillingStatus("0");
+ contract.setBillingStatus("1");
+ contract.setBillingAmout(new BigDecimal("0"));
contract.setErpPushFlag("0");
-
+ contract.setNickName(SecurityUtils.getUser().getNickname());
if (ObjUtil.isNotNull(addDTO.getDeliveryCycle())){
contract.setExpirationDate(DateUtil.offsetDay(addDTO.getSignDate(),addDTO.getDeliveryCycle()));
}
-
- if (!StrUtil.equals(addDTO.getContractCategory(), "water_house")){
+ if (StrUtil.equals(addDTO.getContractCategory(), "water_house")){
+ if(!addDTO.getContractSubjectMatter().stream().allMatch(item->StrUtil.equals(item.getMaterialCode(), "water_bill")||
+ StrUtil.equals(item.getMaterialCode(), "house_rental")||StrUtil.equals(item.getMaterialCode(), "electricity_bill"))){
+ return R.failed("璇锋柊澧炴按/鐢典唬缂存埧灞嬬璧佸悎鍚岋紒");
+ }
+ }else {
+ if(addDTO.getContractSubjectMatter().stream().anyMatch(item->StrUtil.equals(item.getMaterialCode(), "water_bill")||
+ StrUtil.equals(item.getMaterialCode(), "house_rental")||StrUtil.equals(item.getMaterialCode(), "electricity_bill"))){
+ return R.failed("姘寸數浠g即銆佹埧灞嬬璧佷骇鍝佸彧鑳藉湪姘�/鐢典唬缂存埧灞嬬璧佸悎鍚岋紒");
+ }
// 鍋囪 list 鏄綘鐨� List<ContractSubjectMatterAddDTO>
Optional<ContractSubjectMatterAddDTO> maxDateObj = addDTO.getContractSubjectMatter().stream()
.filter(item -> item.getPlannedDeliveryDate() != null) // 杩囨护鎺夋棩鏈熶负绌虹殑椤癸紝閬垮厤 NullPointerException
@@ -139,6 +153,11 @@
}
}
+
+ if (ArrayUtil.isEmpty(addDTO.getContractSubjectMatter().toArray())){
+ return R.failed("鏍囩殑鐗╀笉鑳戒负绌�");
+ }
+
if (StrUtil.equals(SecurityUtils.getUser().getCompId()+"",smj)){
contract.setContractNo(generateSMJContractNo());
}
@@ -154,14 +173,20 @@
if (StrUtil.equals(SecurityUtils.getUser().getCompId()+"",jxc)){
contract.setContractNo(generateJXCContractNo());
}
-
+ if (StrUtil.isNotEmpty(contract.getContractCategory())&&(StrUtil.equals(contract.getContractCategory(),"ymjjgcl")
+ ||StrUtil.equals(contract.getContractCategory(),"ymjgypmm")||StrUtil.equals(contract.getContractCategory(),"ymjgkcpmm")
+ ||StrUtil.equals(contract.getContractCategory(),"ymjcg")||StrUtil.equals(contract.getContractCategory(),"tfgsgypmm")
+ ||StrUtil.equals(contract.getContractCategory(),"smjgypmm")||StrUtil.equals(contract.getContractCategory(),"jxcxsht"))
+ ){
+ contract.setContractName(contract.getContractName()+contract.getContractNo());
+ }
baseMapper.insert(contract);
if (ArrayUtil.isNotEmpty(addDTO.getContractSubjectMatter())) {
addDTO.getContractSubjectMatter().stream().forEach(contractSubjectMatterAddDTO -> {
ContractSubjectMatter subjectMatter = BeanUtil.copyProperties(contractSubjectMatterAddDTO, ContractSubjectMatter.class);
subjectMatter.setContractId(contract.getId());
- subjectMatter.setContractName(contract.getContractName());
+ subjectMatter.setLineNo(ItemGeneratorUtil.nextId());
subjectMatter.setDeliveredQuantity(new BigDecimal("0"));
subjectMatter.setDeliveryStatus(0);
subjectMatter.setTotalAmount(contractSubjectMatterAddDTO.getQuantity().multiply(contractSubjectMatterAddDTO.getUnitPrice()));
@@ -221,6 +246,10 @@
contract.setAcceptScheduleId(schedule.getId());
baseMapper.updateById(contract);
}
+ if (contractPaymentScheduleAddDTO.getStageName().equals("璐ㄤ繚閲�")) {
+ contract.setWarrantyScheduleId(schedule.getId());
+ baseMapper.updateById(contract);
+ }
});
}
@@ -235,10 +264,23 @@
if (!StrUtil.equals(entity.getContractStatus() + "", "0")) {
return R.failed("褰撳墠鐘舵�佹棤娉曚慨鏀瑰悎鍚�");
}
+ if (StrUtil.isEmpty(updateDTO.getPartyA())){
+ BusinessCustomer bc = businessCustomerMapper.selectById(updateDTO.getPartyAId());
+ if (ObjUtil.isNotNull(bc)){
+ updateDTO.setPartyA(bc.getRegisterName());
+ }
+ if (StrUtil.isEmpty(bc.getErpCompanyCode())||StrUtil.isEmpty(bc.getRegisterName())||
+ StrUtil.isEmpty(bc.getBankName())||StrUtil.isEmpty(bc.getBankAccount())){
+ return R.failed("璇峰畬鍠勬敼瀹㈡埛鏁版嵁鍚庡啀娣诲姞鍚堝悓");
+ }
+ }
+
Contract contract = BeanUtil.copyProperties(updateDTO, Contract.class);
- contract.setBillingStatus("0");
+ contract.setBillingStatus("1");
contract.setErpPushFlag("0");
contract.setPaidAmount(new BigDecimal("0"));
+ contract.setBillingAmout(new BigDecimal("0"));
+ contract.setNickName(SecurityUtils.getUser().getNickname());
if (StrUtil.equals(SecurityUtils.getUser().getCompId()+"",smj)){
contract.setContractNo(generateSMJContractNo());
}
@@ -257,7 +299,17 @@
if (ObjUtil.isNotNull(updateDTO.getDeliveryCycle())){
contract.setExpirationDate(DateUtil.offsetDay(updateDTO.getSignDate(),updateDTO.getDeliveryCycle()));
}
- if (!StrUtil.equals(updateDTO.getContractCategory(), "water_house")){
+ if (StrUtil.equals(updateDTO.getContractCategory(), "water_house")){
+ if(!updateDTO.getContractSubjectMatter().stream().allMatch(item->StrUtil.equals(item.getMaterialCode(), "water_bill")||
+ StrUtil.equals(item.getMaterialCode(), "house_rental")||StrUtil.equals(item.getMaterialCode(), "electricity_bill"))){
+ return R.failed("璇锋柊澧炴按/鐢典唬缂存埧灞嬬璧佸悎鍚岋紒");
+ }
+ }else {
+ if(updateDTO.getContractSubjectMatter().stream().anyMatch(item->StrUtil.equals(item.getMaterialCode(), " ")||
+ StrUtil.equals(item.getMaterialCode(), "house_rental")||StrUtil.equals(item.getMaterialCode(), "electricity_bill"))){
+ return R.failed("姘寸數浠g即銆佹埧灞嬬璧佷骇鍝佸彧鑳藉湪姘�/鐢典唬缂存埧灞嬬璧佸悎鍚岋紒");
+ }
+ // 鍋囪 list 鏄綘鐨� List<ContractSubjectMatterAddDTO>
// 鍋囪 list 鏄綘鐨� List<ContractSubjectMatterAddDTO>
Optional<ContractSubjectMatterAddDTO> maxDateObj = updateDTO.getContractSubjectMatter().stream()
.filter(item -> item.getPlannedDeliveryDate() != null) // 杩囨护鎺夋棩鏈熶负绌虹殑椤癸紝閬垮厤 NullPointerException
@@ -268,7 +320,6 @@
}
}
-
baseMapper.updateById(contract);
if (ArrayUtil.isNotEmpty(updateDTO.getContractSubjectMatter())) {
@@ -277,9 +328,10 @@
updateDTO.getContractSubjectMatter().stream().forEach(contractSubjectMatterAddDTO -> {
ContractSubjectMatter subjectMatter = BeanUtil.copyProperties(contractSubjectMatterAddDTO, ContractSubjectMatter.class);
subjectMatter.setContractId(contract.getId());
- subjectMatter.setContractName(contract.getContractName());
+ subjectMatter.setLineNo(ItemGeneratorUtil.nextId());
subjectMatter.setDeliveredQuantity(new BigDecimal("0"));
subjectMatter.setDeliveryStatus(0);
+ subjectMatter.setTotalAmount(contractSubjectMatterAddDTO.getQuantity().multiply(contractSubjectMatterAddDTO.getUnitPrice()));
contractSubjectMatterMapper.insert(subjectMatter);
//姘寸數绫诲繀椤绘湁鍒濇琛ㄥ彿
if (StrUtil.isNotEmpty(contractSubjectMatterAddDTO.getMeterReadCode()) &&
@@ -320,6 +372,10 @@
}
if (contractPaymentScheduleAddDTO.getStageName().equals("璋冭瘯瀹屾垚鎴栭獙鏀�")) {
contract.setAcceptScheduleId(schedule.getId());
+ baseMapper.updateById(contract);
+ }
+ if (contractPaymentScheduleAddDTO.getStageName().equals("璐ㄤ繚閲�")) {
+ contract.setWarrantyScheduleId(schedule.getId());
baseMapper.updateById(contract);
}
});
@@ -568,80 +624,124 @@
// }
}
//erp鎺ㄩ��
- JSONObject request = new JSONObject();
- BusinessCustomer customer = businessCustomerMapper.selectById(contract.getPartyAId());
- request.put("contractNo",contract.getContractNo());
- request.put("partyA",contract.getPartyA());
- request.put("partyACode",customer.getErpCompanyCode());
-
- if (StrUtil.equals(contract.getPartyBId()+"",ymj)&&StrUtil.isNotEmpty(ymjErp)){
- request.put("customerCode",customer.getErpCompanyCode());
- request.put("currencyId","RMB");
- request.put("signDate",DateUtil.format(contract.getSignDate(),DatePattern.NORM_DATETIME_PATTERN));
- request.put("dateDeliver",DateUtil.format(contract.getExpirationDate(),DatePattern.NORM_DATETIME_PATTERN));
- request.put("moneySum",contract.getAmount());
- request.put("signManner","闈㈢");
- request.put("salesman",contract.getCreateBy());
- if (ArrayUtil.isNotEmpty(subjectMatterList.toArray())){
- JSONArray subjectMatter = new JSONArray();
- subjectMatterList.stream().forEach(contractSubjectMatter -> {
- JSONObject subjectMatterItem = new JSONObject();
- subjectMatterItem.put("itemNo",ItemGeneratorUtil.nextId());
- subjectMatterItem.put("salePrice",contractSubjectMatter.getUnitPrice());
- subjectMatterItem.put("qtyRequired",contractSubjectMatter.getQuantity());
- subjectMatterItem.put("money",contractSubjectMatter.getQuantity().multiply(contractSubjectMatter.getUnitPrice()));
- Product product = productMapper.selectOne(Wrappers.<Product>lambdaQuery().eq(Product::getCompId,contract.getCompId())
- .eq(Product::getErpCode,contractSubjectMatter.getMaterialCode()));
- if (ObjUtil.isNotNull(product)){
- subjectMatterItem.put("taxRate",new BigDecimal(product.getTaxRate()).divide(new BigDecimal("100")));
+ new Thread(()->{
+ try {
+ Thread.sleep(500);
+ JSONObject request = new JSONObject();
+ BusinessCustomer customer = businessCustomerMapper.selectById(contract.getPartyAId());
+ request.put("contractNo",contract.getContractNo());
+ request.put("partyA",contract.getPartyA());
+ request.put("partyACode",customer.getErpCompanyCode());
+ if (StrUtil.equals(contract.getPartyBId()+"",ymj)&&StrUtil.isNotEmpty(ymjErp)){
+ request.put("customerCode",customer.getErpCompanyCode());
+ request.put("currencyId","RMB");
+ request.put("signDate",DateUtil.format(contract.getSignDate(),DatePattern.NORM_DATETIME_PATTERN));
+ request.put("dateDeliver",DateUtil.format(contract.getExpirationDate(),DatePattern.NORM_DATETIME_PATTERN));
+ request.put("moneySum",contract.getAmount());
+ request.put("signManner","闈㈢");
+ request.put("salesman","");
+ if (ArrayUtil.isNotEmpty(subjectMatterList.toArray())){
+ JSONArray subjectMatter = new JSONArray();
+ subjectMatterList.stream().forEach(contractSubjectMatter -> {
+ JSONObject subjectMatterItem = new JSONObject();
+ subjectMatterItem.put("itemNo",contractSubjectMatter.getMaterialCode());
+ subjectMatterItem.put("salePrice",contractSubjectMatter.getUnitPrice());
+ subjectMatterItem.put("qtyRequired",contractSubjectMatter.getQuantity());
+ subjectMatterItem.put("money",contractSubjectMatter.getQuantity().multiply(contractSubjectMatter.getUnitPrice()));
+ Product product = productMapper.selectOne(Wrappers.<Product>lambdaQuery().eq(Product::getCompId,contract.getCompId())
+ .eq(Product::getErpCode,contractSubjectMatter.getMaterialCode()));
+ if (ObjUtil.isNotNull(product)){
+ subjectMatterItem.put("taxRate",new BigDecimal(product.getTaxRate()).divide(new BigDecimal("100")));
+ }
+ subjectMatterItem.put("dateDeliver",ObjUtil.isNotNull(contractSubjectMatter.getPlannedDeliveryDate())?
+ DateUtil.format(contractSubjectMatter.getPlannedDeliveryDate(),DatePattern.NORM_DATETIME_PATTERN):
+ DateUtil.format(contract.getExpirationDate(),DatePattern.NORM_DATETIME_PATTERN));
+ subjectMatter.add(subjectMatterItem);
+ });
+ request.put("details",subjectMatter);
}
- subjectMatterItem.put("dateDeliver",ObjUtil.isNotNull(contractSubjectMatter.getPlannedDeliveryDate())?
- DateUtil.format(contractSubjectMatter.getPlannedDeliveryDate(),DatePattern.NORM_DATETIME_PATTERN):
- DateUtil.format(contract.getExpirationDate(),DatePattern.NORM_DATETIME_PATTERN));
- subjectMatter.add(subjectMatterItem);
- });
- request.put("details",subjectMatter);
- }
- log.info("涓�鐓ゆ満鍚堝悓鎺ㄩ�乪rp鍏ュ弬锛歿}",request.toJSONString());
- HttpResponse response = HttpRequest.post(ymjErp)
- .header("token", ymjToken) // 娣诲姞璁よ瘉澶�
- .header("Content-Type", "application/json") // 璁剧疆鍐呭绫诲瀷
- .body(request.toJSONString()) // 璁剧疆璇锋眰浣�
- .execute(); // 鎵ц璇锋眰.post(ymjErp,request.toJSONString());
- log.info("涓�鐓ゆ満鍚堝悓鎺ㄩ�乪rp鍥炲弬锛歿}",response.body());
- //淇濆瓨璇锋眰璁板綍
- saveErpRequestRecord("ymj",request.toJSONString(),response.body());
- //鏇存柊鍚堝悓erp鎺ㄩ�佹爣璇�
- contract.setErpPushFlag("1");
- baseMapper.updateById(contract);
- }
- if (StrUtil.equals(contract.getPartyBId()+"",smj)&&StrUtil.isNotEmpty(smjErp)){
- log.info("鐭崇叅鏈哄悎鍚屾帹閫乪rp鍏ュ弬锛歿}",request.toJSONString());
- String result = HttpUtil.post(ymjErp,request.toJSONString());
- log.info("鐭崇叅鏈哄悎鍚屾帹閫乪rp鍥炲弬锛歿}",result);
- //淇濆瓨璇锋眰璁板綍
- saveErpRequestRecord("smj",request.toJSONString(),result);
- //鏇存柊鍚堝悓erp鎺ㄩ�佹爣璇�
- contract.setErpPushFlag("1");
- baseMapper.updateById(contract);
- }
- if (StrUtil.equals(contract.getPartyBId()+"",jxc)&&StrUtil.isNotEmpty(jxcErp)){
- log.info("鏈烘鍘傚悎鍚屾帹閫乪rp鍏ュ弬锛歿}",request.toJSONString());
- String result = HttpUtil.post(ymjErp,request.toJSONString());
- log.info("鏈烘鍘傚悎鍚屾帹閫乪rp鍥炲弬锛歿}",result);
- //淇濆瓨璇锋眰璁板綍
- saveErpRequestRecord("jxc",request.toJSONString(),result);
- //鏇存柊鍚堝悓erp鎺ㄩ�佹爣璇�
- contract.setErpPushFlag("1");
- baseMapper.updateById(contract);
- }
- if (StrUtil.equals(contract.getPartyBId()+"",tfgs)&&StrUtil.isNotEmpty(tfgsErp)){
- //閫氭柟鍏徃閫氳繃绯荤粺褰曞叆
- }
- if (StrUtil.equals(contract.getPartyBId()+"",sgb)&&StrUtil.isNotEmpty(sgbErp)){
- //鐭冲伐娉典富鍔ㄦ帹閫佺郴缁�
- }
+ JSONObject loginJson = new JSONObject();
+ loginJson.put("username","admin");
+ loginJson.put("password","admin123");
+ log.info("涓�鐓ゆ満鍚堝悓鎺ㄩ�佽幏鍙杢oken鍏ュ弬锛歿}",loginJson.toJSONString());
+ String loginResp = HttpUtil.post(ymjErp+"/api/account/v1/login",loginJson.toJSONString());
+ log.info("涓�鐓ゆ満鍚堝悓鎺ㄩ�佽幏鍙杢oken鍥炲弬锛歿}",loginResp);
+ JSONObject respJson = JSONObject.parseObject(loginResp);
+ if (respJson.getInteger("code")==0){
+ JSONObject dataJson = JSONObject.parseObject(respJson.getString("data"));
+ log.info("涓�鐓ゆ満鍚堝悓鎺ㄩ�乪rp鍏ュ弬锛歿}",request.toJSONString());
+ HttpResponse response = HttpRequest.post(ymjErp+"/api/contract-staging/v1/receive")
+ .header("token", dataJson.getString("token")) // 娣诲姞璁よ瘉澶�
+ .header("Content-Type", "application/json") // 璁剧疆鍐呭绫诲瀷
+ .body(request.toJSONString()) // 璁剧疆璇锋眰浣�
+ .execute(); // 鎵ц璇锋眰.post(ymjErp,request.toJSONString());
+ log.info("涓�鐓ゆ満鍚堝悓鎺ㄩ�乪rp鍥炲弬锛歿}",response.body());
+ //淇濆瓨璇锋眰璁板綍
+ saveErpRequestRecord("ymj",request.toJSONString(),response.body());
+ //鏇存柊鍚堝悓erp鎺ㄩ�佹爣璇�
+ contract.setErpPushFlag("1");
+ baseMapper.updateById(contract);
+ }
+
+ }
+ if (StrUtil.equals(contract.getPartyBId()+"",smj)&&StrUtil.isNotEmpty(smjErp)){
+ log.info("鐭崇叅鏈哄悎鍚屾帹閫乪rp鍏ュ弬锛歿}",request.toJSONString());
+ String result = HttpUtil.post(smjErp,request.toJSONString());
+ log.info("鐭崇叅鏈哄悎鍚屾帹閫乪rp鍥炲弬锛歿}",result);
+ //淇濆瓨璇锋眰璁板綍
+ saveErpRequestRecord("smj",request.toJSONString(),result);
+ //鏇存柊鍚堝悓erp鎺ㄩ�佹爣璇�
+ contract.setErpPushFlag("1");
+ baseMapper.updateById(contract);
+ }
+
+ if (StrUtil.equals(contract.getPartyBId()+"",jxc)&&StrUtil.isNotEmpty(jxcErp)){
+ log.info("鏈烘鍘傚悎鍚屾帹閫乪rp鍏ュ弬锛歿}",request.toJSONString());
+ String result = HttpUtil.post(jxcErp,request.toJSONString());
+ log.info("鏈烘鍘傚悎鍚屾帹閫乪rp鍥炲弬锛歿}",result);
+ //淇濆瓨璇锋眰璁板綍
+ saveErpRequestRecord("jxc",request.toJSONString(),result);
+ //鏇存柊鍚堝悓erp鎺ㄩ�佹爣璇�
+ contract.setErpPushFlag("1");
+ baseMapper.updateById(contract);
+ }
+ if (StrUtil.equals(contract.getPartyBId()+"",tfgs)&&StrUtil.isNotEmpty(tfgsErp)){
+ //閫氭柟鍏徃閫氳繃绯荤粺褰曞叆
+ }
+ if (StrUtil.equals(contract.getPartyBId()+"",sgb)&&StrUtil.isNotEmpty(sgbErp)){
+ //鐭冲伐娉典富鍔ㄦ帹閫佺郴缁�
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }).start();
+ //鍚堝悓涓績鎺ㄩ��
+ 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);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }).start();
}
private void saveErpRequestRecord(String ymj, String toJSONString, String result) {
@@ -686,7 +786,7 @@
PaymentConfirm contractLastConfirm = paymentConfirmMapper.selectOne(Wrappers.<PaymentConfirm>lambdaQuery().eq(PaymentConfirm::getContractId, completeContract.getId())
.orderByDesc(PaymentConfirm::getCreateTime).last("limit 1"));
//鏌ヨ瀹㈡埛浠樻瀹屾垚鍚堝悓涓渶鍚庢槑缁嗛噾棰� 鏈夐鏀惰浆鍏ュ綋鍓嶅悎鍚�
- if (contractLastConfirm.getTotalAmount().compareTo(new BigDecimal("0")) > 0) {
+ if (ObjUtil.isNotNull(contractLastConfirm)&&contractLastConfirm.getTotalAmount().compareTo(new BigDecimal("0")) > 0) {
//鏂板瀹屾垚浠樻鍚堝悓 璧勯噾杞嚭
PaymentConfirm outConfirm = BeanUtil.copyProperties(contractLastConfirm, PaymentConfirm.class, "id", "transationAmount",
"advanceAmount", "receivableAmount", "overdueAmount", "totalAmount");
@@ -737,55 +837,57 @@
if (ArrayUtil.isNotEmpty(scheduleList.toArray())) {
scheduleList.stream().forEach(contractPaymentSchedule -> {
Contract contract = baseMapper.selectById(contractPaymentSchedule.getContractId());
- //搴旀敹瓒呮湡
- PaymentConfirm overdueConfirm = new PaymentConfirm();
- overdueConfirm.setBusinessType("搴旀敹瓒呮湡");
- overdueConfirm.setBusGuestId(contract.getPartyAId());
- overdueConfirm.setBusGuestName(contract.getPartyA());
- overdueConfirm.setContractId(contract.getId());
- overdueConfirm.setContractName(contract.getContractName());
- overdueConfirm.setContractNo(contract.getContractNo());
- overdueConfirm.setConfirmTime(new Date());
- overdueConfirm.setScheduleId(contractPaymentSchedule.getId());
- overdueConfirm.setScheduleName(contractPaymentSchedule.getStageName());
- PaymentConfirm newLastConfirm = paymentConfirmMapper.selectOne(Wrappers.<PaymentConfirm>lambdaQuery().eq(PaymentConfirm::getContractId, contract.getId())
- .orderByDesc(PaymentConfirm::getCreateTime).last("limit 1"));
- if(ObjUtil.isNotNull(newLastConfirm)){
- overdueConfirm.setTransationAmount(StrUtil.equals(contractPaymentSchedule.getPaymentStatus() + "", "0") ?
- contractPaymentSchedule.getPlannedAmount() :
- contractPaymentSchedule.getPlannedAmount().subtract(contractPaymentSchedule.getActualAmount()));
- overdueConfirm.setReceivableAmount(newLastConfirm.getTotalAmount().multiply(new BigDecimal("-1")));
- overdueConfirm.setOverdueAmount(overdueConfirm.getTransationAmount());
- overdueConfirm.setTotalAmount(newLastConfirm.getTotalAmount());
- overdueConfirm.setCompId(contract.getCompId());
- //鍒ゆ柇褰撳墠闃舵鏄惁宸茬敓鎴愪笂闃舵搴旀敹瓒呮湡
- PaymentConfirm oiverdueConfirm = paymentConfirmMapper.selectOne(Wrappers.<PaymentConfirm>lambdaQuery().eq(PaymentConfirm::getScheduleId, contractPaymentSchedule.getId())
- .eq(PaymentConfirm::getBusinessType, "搴旀敹瓒呮湡"));
- if (ObjUtil.isNull(oiverdueConfirm) && overdueConfirm.getTransationAmount().compareTo(new BigDecimal("0")) > 0) {
- paymentConfirmMapper.insert(overdueConfirm);
- }
- //褰撳墠閫炬湡
- CurrentOverdue currentOverdue = new CurrentOverdue();
- currentOverdue.setBusGuestId(contract.getPartyAId());
- currentOverdue.setBusGuestName(contract.getPartyA());
- currentOverdue.setContractId(contractPaymentSchedule.getContractId());
- currentOverdue.setContractName(contractPaymentSchedule.getContractName());
- currentOverdue.setScheduleId(contractPaymentSchedule.getId());
- currentOverdue.setScheduleName(contractPaymentSchedule.getStageName());
- currentOverdue.setCompId(contract.getCompId());
- currentOverdue.setContractExpirTime(contractPaymentSchedule.getEffectiveEndDate());
- currentOverdue.setReceivableAmount(StrUtil.equals(contractPaymentSchedule.getPaymentStatus() + "", "0") ?
- contractPaymentSchedule.getPlannedAmount() : contractPaymentSchedule.getPlannedAmount().subtract(contractPaymentSchedule.getActualAmount()));
- currentOverdue.setOverdueDuration(BigDecimal.valueOf(DateUtil.betweenDay(contractPaymentSchedule.getEffectiveEndDate(), new Date(), true)));
- CurrentOverdue overdue = currentOverdueMapper.selectOne(Wrappers.<CurrentOverdue>lambdaQuery().eq(CurrentOverdue::getContractId, currentOverdue.getContractId())
- .eq(CurrentOverdue::getScheduleId, currentOverdue.getScheduleId()).last("limit 1"));
- if (ObjUtil.isNull(overdue)) {
- if (currentOverdue.getReceivableAmount().compareTo(new BigDecimal("0")) > 0) {
- currentOverdueMapper.insert(currentOverdue);
+ if (ObjUtil.isNotNull(contract)) {
+ //搴旀敹瓒呮湡
+ PaymentConfirm overdueConfirm = new PaymentConfirm();
+ overdueConfirm.setBusinessType("搴旀敹瓒呮湡");
+ overdueConfirm.setBusGuestId(contract.getPartyAId());
+ overdueConfirm.setBusGuestName(contract.getPartyA());
+ overdueConfirm.setContractId(contract.getId());
+ overdueConfirm.setContractName(contract.getContractName());
+ overdueConfirm.setContractNo(contract.getContractNo());
+ overdueConfirm.setConfirmTime(new Date());
+ overdueConfirm.setScheduleId(contractPaymentSchedule.getId());
+ overdueConfirm.setScheduleName(contractPaymentSchedule.getStageName());
+ PaymentConfirm newLastConfirm = paymentConfirmMapper.selectOne(Wrappers.<PaymentConfirm>lambdaQuery().eq(PaymentConfirm::getContractId, contract.getId())
+ .orderByDesc(PaymentConfirm::getCreateTime).last("limit 1"));
+ if (ObjUtil.isNotNull(newLastConfirm)) {
+ overdueConfirm.setTransationAmount(StrUtil.equals(contractPaymentSchedule.getPaymentStatus() + "", "0") ?
+ contractPaymentSchedule.getPlannedAmount() :
+ contractPaymentSchedule.getPlannedAmount().subtract(contractPaymentSchedule.getActualAmount()));
+ overdueConfirm.setReceivableAmount(newLastConfirm.getTotalAmount().multiply(new BigDecimal("-1")));
+ overdueConfirm.setOverdueAmount(overdueConfirm.getTransationAmount());
+ overdueConfirm.setTotalAmount(newLastConfirm.getTotalAmount());
+ overdueConfirm.setCompId(contract.getCompId());
+ //鍒ゆ柇褰撳墠闃舵鏄惁宸茬敓鎴愪笂闃舵搴旀敹瓒呮湡
+ PaymentConfirm oiverdueConfirm = paymentConfirmMapper.selectOne(Wrappers.<PaymentConfirm>lambdaQuery().eq(PaymentConfirm::getScheduleId, contractPaymentSchedule.getId())
+ .eq(PaymentConfirm::getBusinessType, "搴旀敹瓒呮湡"));
+ if (ObjUtil.isNull(oiverdueConfirm) && overdueConfirm.getTransationAmount().compareTo(new BigDecimal("0")) > 0) {
+ paymentConfirmMapper.insert(overdueConfirm);
}
- } else {
- overdue.setOverdueDuration(BigDecimal.valueOf(DateUtil.betweenDay(contractPaymentSchedule.getEffectiveEndDate(), new Date(), true)));
- currentOverdueMapper.updateById(overdue);
+ //褰撳墠閫炬湡
+ CurrentOverdue currentOverdue = new CurrentOverdue();
+ currentOverdue.setBusGuestId(contract.getPartyAId());
+ currentOverdue.setBusGuestName(contract.getPartyA());
+ currentOverdue.setContractId(contractPaymentSchedule.getContractId());
+ currentOverdue.setContractName(contractPaymentSchedule.getContractName());
+ currentOverdue.setScheduleId(contractPaymentSchedule.getId());
+ currentOverdue.setScheduleName(contractPaymentSchedule.getStageName());
+ currentOverdue.setCompId(contract.getCompId());
+ currentOverdue.setContractExpirTime(contractPaymentSchedule.getEffectiveEndDate());
+ currentOverdue.setReceivableAmount(StrUtil.equals(contractPaymentSchedule.getPaymentStatus() + "", "0") ?
+ contractPaymentSchedule.getPlannedAmount() : contractPaymentSchedule.getPlannedAmount().subtract(contractPaymentSchedule.getActualAmount()));
+ currentOverdue.setOverdueDuration(BigDecimal.valueOf(DateUtil.betweenDay(contractPaymentSchedule.getEffectiveEndDate(), new Date(), true)));
+ CurrentOverdue overdue = currentOverdueMapper.selectOne(Wrappers.<CurrentOverdue>lambdaQuery().eq(CurrentOverdue::getContractId, currentOverdue.getContractId())
+ .eq(CurrentOverdue::getScheduleId, currentOverdue.getScheduleId()).last("limit 1"));
+ if (ObjUtil.isNull(overdue)) {
+ if (currentOverdue.getReceivableAmount().compareTo(new BigDecimal("0")) > 0) {
+ currentOverdueMapper.insert(currentOverdue);
+ }
+ } else {
+ overdue.setOverdueDuration(BigDecimal.valueOf(DateUtil.betweenDay(contractPaymentSchedule.getEffectiveEndDate(), new Date(), true)));
+ currentOverdueMapper.updateById(overdue);
+ }
}
}
});
@@ -806,9 +908,10 @@
Contract oldContract = baseMapper.selectById(id);
Contract newContract = BeanUtil.copyProperties(oldContract, Contract.class, "id", "createTime");
newContract.setPaidAmount(new BigDecimal("0"));
- newContract.setBillingStatus("0");
+ newContract.setBillingStatus("1");
newContract.setErpPushFlag("0");
newContract.setContractStatus(0);
+ newContract.setBillingAmout(new BigDecimal("0"));
if (StrUtil.equals(SecurityUtils.getUser().getCompId()+"",smj)){
newContract.setContractNo(generateSMJContractNo());
}
@@ -883,7 +986,7 @@
map.put("items", items);
//瀹氬埗鏂�
BusinessCustomer customer = businessCustomerMapper.selectById(contract.getPartyAId());
- map.put("companyName", customer.getRegisterName());
+ map.put("companyName", contract.getPartyA());
map.put("legalPerson", customer.getLegalPerson());
map.put("contactPhone", customer.getContactPhone());
map.put("bankName", customer.getBankName());
@@ -947,6 +1050,7 @@
if (StrUtil.isNotEmpty(subjectMatter.getMeterReadCode()) &&
ObjUtil.isNotNull(subjectMatter.getMeterReadNum())) {
MeterReadRecord record = BeanUtil.copyProperties(subjectMatter, MeterReadRecord.class, "id","meterReadNum");
+ record.setContractName(contract.getContractName());
record.setMatterId(subjectMatter.getId());
record.setBusGuestId(contract.getPartyAId());
record.setBusGuestName(contract.getPartyA());
@@ -970,6 +1074,10 @@
schedule.setPaymentStatus(0);
schedule.setActualAmount(new BigDecimal("0"));
schedule.setCompId(contract.getCompId());
+ schedule.setSubjectMatterCode(subjectMatter.getMaterialCode());
+ schedule.setSubjectMatterName(subjectMatter.getMaterialInternalName());
+ schedule.setRemark(DateUtil.formatDate(contractExecDate.getExecDate())+schedule.getStageName());
+ schedule.setInvoiceFlag("0");
contractPaymentScheduleMapper.insert(schedule);
//鎴垮眿绉熻祦鐢熸垚搴旀敹
PaymentConfirm confirm = new PaymentConfirm();
@@ -1336,6 +1444,7 @@
map.put("partyA",contract.getPartyA());
map.put("partyB",contract.getPartyB());
map.put("delayDay",dto.getDelayDay());
+ map.put("contractNo",contract.getContractNo());
map.put("applyName",SecurityUtils.getUser().getUsername());
map.put("applyTime",DateUtil.format(delayOut.getApplyTime(),DatePattern.NORM_DATETIME_FORMAT));
//鍚姩娴佺▼
@@ -1460,8 +1569,16 @@
contract.setPartyB(SecurityUtils.getUser().getCompName());
contract.setContractStatus(2);
contract.setPaidAmount(new BigDecimal("0"));
- contract.setBillingStatus("0");
+ contract.setBillingStatus("1");
contract.setErpPushFlag("1");
+ contract.setBillingAmout(new BigDecimal("0"));
+
+ BusinessCustomer bc = businessCustomerMapper.selectOne(Wrappers.<BusinessCustomer>lambdaQuery().eq(BusinessCustomer::getErpCompanyCode,
+ addDTO.getPartyACode()).last("limit 1"));
+ if (ObjUtil.isNull(bc)){
+ return R.failed("erp瀹㈡埛缂栫爜涓嶅瓨鍦�");
+ }
+ contract.setPartyAId(bc.getId());
if (ObjUtil.isNotNull(addDTO.getDeliveryCycle())){
contract.setExpirationDate(DateUtil.offsetDay(addDTO.getSignDate(),addDTO.getDeliveryCycle()));
}
@@ -1485,7 +1602,7 @@
addDTO.getContractSubjectMatter().stream().forEach(contractSubjectMatterAddDTO -> {
ContractSubjectMatter subjectMatter = BeanUtil.copyProperties(contractSubjectMatterAddDTO, ContractSubjectMatter.class);
subjectMatter.setContractId(contract.getId());
- subjectMatter.setContractName(contract.getContractName());
+
subjectMatter.setDeliveredQuantity(new BigDecimal("0"));
subjectMatter.setDeliveryStatus(0);
subjectMatter.setTotalAmount(contractSubjectMatterAddDTO.getQuantity().multiply(contractSubjectMatterAddDTO.getUnitPrice()));
@@ -1550,7 +1667,7 @@
}
- return R.ok(contract.getId());
+ return R.ok(contract.getContractNo());
}
@Override
@@ -1569,7 +1686,12 @@
return R.failed("浠樻闃舵姣斾緥寮傚父");
}
+ Contract contractOld = baseMapper.selectOne(Wrappers.<Contract>lambdaQuery().eq(Contract::getDataId,updateDTO.getDataId()).last("limit 1"));
+ if (ObjUtil.isNull(contractOld)){
+ return R.failed("鍚堝悓鏁版嵁ID锛歿}涓嶅瓨鍦紝璇峰厛鏂板鍚庡啀淇敼",updateDTO.getDataId());
+ }
Contract contract = BeanUtil.copyProperties(updateDTO, Contract.class);
+ contract.setId(contractOld.getId());
if (ObjUtil.isNotNull(updateDTO.getDeliveryCycle())){
contract.setExpirationDate(DateUtil.offsetDay(updateDTO.getSignDate(),updateDTO.getDeliveryCycle()));
}
@@ -1592,7 +1714,7 @@
updateDTO.getContractSubjectMatter().stream().forEach(contractSubjectMatterAddDTO -> {
ContractSubjectMatter subjectMatter = BeanUtil.copyProperties(contractSubjectMatterAddDTO, ContractSubjectMatter.class);
subjectMatter.setContractId(contract.getId());
- subjectMatter.setContractName(contract.getContractName());
+
subjectMatter.setDeliveredQuantity(new BigDecimal("0"));
subjectMatter.setDeliveryStatus(0);
contractSubjectMatterMapper.insert(subjectMatter);
@@ -1776,4 +1898,263 @@
return "ZB-GYB-"+dateStr + seqStr;
}
+ @Override
+ public R abortContractSgb(String dataId) {
+ Contract contractOld = baseMapper.selectOne(Wrappers.<Contract>lambdaQuery().eq(Contract::getDataId,dataId).last("limit 1"));
+ if (ObjUtil.isNull(contractOld)){
+ return R.failed("鍚堝悓鏁版嵁ID锛歿}涓嶅瓨鍦紝璇峰厛鏂板鍚庡啀鎿嶄綔",dataId);
+ }
+ contractOld.setContractStatus(4);
+ baseMapper.updateById(contractOld);
+ return R.ok();
+ }
+
+ @Override
+ public R delContractSgb(String dataId) {
+ Contract contractOld = baseMapper.selectOne(Wrappers.<Contract>lambdaQuery().eq(Contract::getDataId,dataId).last("limit 1"));
+ if (ObjUtil.isNull(contractOld)){
+ return R.failed("鍚堝悓鏁版嵁ID锛歿}涓嶅瓨鍦紝璇峰厛鏂板鍚庡啀鎿嶄綔",dataId);
+ }
+
+ contractPaymentScheduleMapper.delete(Wrappers.<ContractPaymentSchedule>lambdaQuery().eq(ContractPaymentSchedule::getContractId,contractOld.getId()));
+ contractSubjectMatterMapper.delete(Wrappers.<ContractSubjectMatter>lambdaQuery().eq(ContractSubjectMatter::getContractId,contractOld.getId()));
+ paymentConfirmMapper.delete(Wrappers.<PaymentConfirm>lambdaQuery().eq(PaymentConfirm::getContractId,contractOld.getId()));
+ baseMapper.deleteById(contractOld);
+ return R.ok();
+ }
+
+ @Override
+ public Page fourAssociation(Page page,ContractQueryDTO queryDTO) {
+ Page<FourAssociationPageVo> page1 = baseMapper.fourAssociation(page,queryDTO,DataScope.of("comp_id"));
+ if (ArrayUtil.isNotEmpty(page1.getRecords().toArray())){
+ page1.getRecords().stream().forEach(fourAssociationPageVo -> {
+ List<PaymentSlip> slips = paymentSlipMapper.selectList(Wrappers.<PaymentSlip>lambdaQuery().eq(PaymentSlip::getContractId,fourAssociationPageVo.getId())
+ .orderByAsc(PaymentSlip::getPaymentTime));
+ if (ArrayUtil.isNotEmpty(slips.toArray())){
+ fourAssociationPageVo.setSlipVoList(BeanUtil.copyToList(slips,ContractSlipVo.class));
+ }
+ List<ContractInvoice> invoices = contractInvoiceMapper.selectList(Wrappers.<ContractInvoice>lambdaQuery().eq(ContractInvoice::getContractId,fourAssociationPageVo.getId())
+ .orderByAsc(ContractInvoice::getInvoiceTime));
+ if (ArrayUtil.isNotEmpty(invoices.toArray())){
+ fourAssociationPageVo.setInvoiceVoList(BeanUtil.copyToList(invoices, ContractInvoiceVo.class));
+ }
+ if (fourAssociationPageVo.getAmount().compareTo(fourAssociationPageVo.getPaidAmount())==0&&
+ fourAssociationPageVo.getAmount().compareTo(fourAssociationPageVo.getBillingAmout())==0){
+ fourAssociationPageVo.setAssociation("宸插畬鎴�");
+ }
+ });
+ }
+ return page1;
+ }
+
+ @Override
+ public void exportContractSMJGYPMMWord(Long id, HttpServletResponse response) {
+ Contract contract = baseMapper.selectById(id);
+ List<ContractSubjectMatter> subjectMatterList = contractSubjectMatterMapper.selectList(Wrappers.<ContractSubjectMatter>lambdaQuery()
+ .eq(ContractSubjectMatter::getContractId, id).orderByAsc(ContractSubjectMatter::getCreateTime));
+ Map<String, Object> map = new HashMap<>();
+ //鍚堝悓鍩烘湰淇℃伅
+ map.put("partyA", contract.getPartyA());
+ map.put("partyB", contract.getPartyB());
+ map.put("contractNo", contract.getContractNo());
+ map.put("signPlace", contract.getSignPlace());
+ map.put("signDate", DateUtil.formatDate(contract.getSignDate()));
+ map.put("signDateYMD", DateUtil.format(contract.getSignDate(), DatePattern.CHINESE_DATE_PATTERN));
+ map.put("total", contract.getAmount());
+ map.put("totalNoTax", contract.getAmount().divide(new BigDecimal("100").add(new BigDecimal("13")), 2, RoundingMode.HALF_UP)
+ .multiply(new BigDecimal("87")));
+ map.put("amountWords", Convert.digitToChinese(contract.getAmount()));
+ //鏍囩殑鐗�
+ List<Map<String, Object>> items = new ArrayList<>();
+ subjectMatterList.stream().forEach(contractSubjectMatter -> {
+ Map<String, Object> item = new HashMap<>();
+ item.put("materialName", contractSubjectMatter.getMaterialName());
+ item.put("guige", contractSubjectMatter.getSpecification());
+ item.put("unit", contractSubjectMatter.getUnit());
+ item.put("quantity", contractSubjectMatter.getQuantity());
+ item.put("unitPrice", contractSubjectMatter.getUnitPrice());
+ item.put("price", contractSubjectMatter.getTotalAmount());
+ item.put("remarks", contractSubjectMatter.getRemarks());
+ items.add(item);
+ });
+ map.put("items", items);
+ //瀹氬埗鏂�
+ BusinessCustomer customer = businessCustomerMapper.selectById(contract.getPartyAId());
+ map.put("companyName", customer.getRegisterName());
+ map.put("legalPerson", customer.getLegalPerson());
+ map.put("contactPhone", customer.getContactPhone());
+ map.put("bankName", customer.getBankName());
+ map.put("bankAccount", customer.getBankAccount());
+
+ //鎵挎徑鏂�
+ R<SysDept> r = remoteDeptService.getById(contract.getPartyBId());
+ SysDept dept = r.getData();
+ map.put("orgName", dept.getOrgName());
+ map.put("legalPerson1", StrUtil.isNotEmpty(dept.getLegalPerson()) ? dept.getLegalPerson() : "");
+ map.put("entrustedAgent", StrUtil.isNotEmpty(dept.getLegalPerson()) ? "" : dept.getEntrustedAgent());
+ map.put("orgContact", dept.getOrgContact());
+ map.put("orgBank", dept.getOrgBank());
+ map.put("orgBankAccount", dept.getOrgBankAccount());
+
+ //鐢熸垚鏂囦欢鍚�
+ Long time = new Date().getTime();
+ // 鐢熸垚鐨剋ord鏍煎紡
+ String formatSuffix = ".docx";
+ // 鎷兼帴鍚庣殑鏂囦欢鍚�
+ String fileName = time + formatSuffix;//鏂囦欢鍚� 甯﹀悗缂�
+ //瀵煎嚭word
+ try {
+ // 1. 鍔犺浇妯$増
+ // 鍋囪妯$増鍦� resources/templates/template.docx
+ ClassPathResource resource = new ClassPathResource("template/smj/smjgypmmht.docx");
+ // 閰嶇疆鍒楄〃绛栫暐
+ Configure config = Configure.builder()
+ .bind("items", new LoopRowTableRenderPolicy()) // 灏� items 缁戝畾鍒拌寰幆绛栫暐
+ .build();
+ // 2. 缂栬瘧骞舵覆鏌撴暟鎹�
+ XWPFTemplate xwpfTemplate = XWPFTemplate.compile(resource.getInputStream(), config).render(map);
+
+ // 3. 璁剧疆鍝嶅簲澶�
+ response.setContentType("application/vnd.openxmlformats-officedocument.wordprocessingml.document");
+ response.setCharacterEncoding("utf-8");
+ response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".docx");
+
+ // 4. 鍐欏叆杈撳嚭娴�
+ OutputStream out = response.getOutputStream();
+ xwpfTemplate.write(out);
+ out.flush();
+ out.close();
+ xwpfTemplate.close(); // 閲嶈锛氬叧闂ā鐗堥噴鏀捐祫婧�
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Override
+ public void exportContractJXCXSWord(Long id, HttpServletResponse response) {
+ Contract contract = baseMapper.selectById(id);
+ List<ContractSubjectMatter> subjectMatterList = contractSubjectMatterMapper.selectList(Wrappers.<ContractSubjectMatter>lambdaQuery()
+ .eq(ContractSubjectMatter::getContractId, id).orderByAsc(ContractSubjectMatter::getCreateTime));
+ List<ContractPaymentSchedule> scheduleList = contractPaymentScheduleMapper.selectList(Wrappers.<ContractPaymentSchedule>lambdaQuery()
+ .eq(ContractPaymentSchedule::getContractId, id).orderByAsc(ContractPaymentSchedule::getCreateTime));
+ Map<String, Object> map = new HashMap<>();
+ //鍚堝悓鍩烘湰淇℃伅
+ map.put("partyA", contract.getPartyA());
+ map.put("partyB", contract.getPartyB());
+ map.put("contractNo", contract.getContractNo());
+ map.put("signPlace", contract.getSignPlace());
+ map.put("signDate", DateUtil.formatDate(contract.getSignDate()));
+ map.put("signDateYMD", DateUtil.format(contract.getSignDate(), DatePattern.CHINESE_DATE_PATTERN));
+ map.put("total", contract.getAmount());
+ map.put("amountWords", Convert.digitToChinese(contract.getAmount()));
+ //姝f枃
+ map.put("standard", contract.getStandard());
+ map.put("useMonth", contract.getUseMonth());
+ map.put("afterShipMonth", contract.getAfterShipMonth());
+ map.put("deliveryCycle", contract.getDeliveryCycle());
+ map.put("advancePayment", contract.getAdvancePayment()+"%");
+ map.put("inspectDay", contract.getInspectDay());
+ map.put("acceptDay", contract.getAcceptDay());
+ map.put("delayAcceptDay", contract.getDelayAcceptDay());
+ map.put("acceptPassDay", contract.getAcceptPassDay());
+ map.put("acceptPassAmount", contract.getAcceptPassAmount()+"%");
+ map.put("deliverDay", contract.getDeliverDay());
+ map.put("deliverCompleteDay", contract.getDeliverCompleteDay());
+ map.put("shipAddress", contract.getShipAddress());
+ map.put("htqdr", scheduleList.get(0).getAgreedDays());
+ map.put("htqdq", scheduleList.get(0).getPaymentRatio()+"%");
+ map.put("fhqq", scheduleList.get(1).getPaymentRatio()+"%");
+ map.put("dhhr", scheduleList.get(2).getAgreedDays());
+ map.put("dhhq", scheduleList.get(2).getPaymentRatio()+"%");
+ map.put("zbjq", scheduleList.get(4).getPaymentRatio()+"%");
+ map.put("zbqm", scheduleList.get(4).getAgreedDays());
+ map.put("paymentMethod", contract.getPaymentMethod());
+ map.put("invoiceNotice", contract.getInvoiceNotice());
+ map.put("supplierAgent", contract.getSupplierAgent());
+ map.put("supplierAgentIDCard", contract.getSupplierAgentIdCard());
+ map.put("buyerAgent", contract.getBuyerAgent());
+ map.put("buyerAgentIDCard", contract.getBuyerAgentIdCard());
+ map.put("agentAuthority", contract.getAgentAuthority());
+ map.put("delayPayAdvancePayment", contract.getDelayPayAdvancePayment()+"%");
+ map.put("delayPayAProcessPayment", contract.getDelayPayProcessPayment()+"%");
+ map.put("receiveAdvancePaymentMonth", contract.getReceiveAdvancePaymentMonth());
+ map.put("noticeSupplierAcceptDay", contract.getNoticeSupplierAcceptDay());
+ map.put("overdueDay", contract.getOverdueDay());
+ map.put("lossAmount", contract.getLossAmount()+"%");
+ map.put("liquidatedDamagesHighSupplier", contract.getLiquidatedDamagesHighSupplier()+"%");
+ map.put("overdueDayXf", contract.getOverdueDayXf());
+ map.put("lossAmountXf", contract.getLossAmountXf()+"%");
+ map.put("liquidatedDamagesHighBuyer", contract.getLiquidatedDamagesHighBuyer()+"%");
+ map.put("contractAttchment", contract.getContractAttchment());
+ map.put("totalParts", contract.getTotalParts());
+ map.put("supplierPart", contract.getSupplierPart());
+ map.put("buyerPart", contract.getBuyerPart());
+
+
+
+ //鏍囩殑鐗�
+ List<Map<String, Object>> items = new ArrayList<>();
+ subjectMatterList.stream().forEach(contractSubjectMatter -> {
+ Map<String, Object> item = new HashMap<>();
+ item.put("materialName", contractSubjectMatter.getMaterialName());
+ item.put("guige", contractSubjectMatter.getSpecification());
+ item.put("unit", contractSubjectMatter.getUnit());
+ item.put("quantity", contractSubjectMatter.getQuantity());
+ item.put("unitPrice", contractSubjectMatter.getUnitPrice());
+ item.put("price", contractSubjectMatter.getTotalAmount());
+ item.put("remarks", contractSubjectMatter.getRemarks());
+ items.add(item);
+ });
+ map.put("items", items);
+ //瀹氬埗鏂�
+ BusinessCustomer customer = businessCustomerMapper.selectById(contract.getPartyAId());
+ map.put("companyName", customer.getRegisterName());
+ map.put("legalPerson", customer.getLegalPerson());
+ map.put("contactPhone", customer.getContactPhone());
+ map.put("bankName", customer.getBankName());
+ map.put("bankAccount", customer.getBankAccount());
+
+ //鎵挎徑鏂�
+ R<SysDept> r = remoteDeptService.getById(contract.getPartyBId());
+ SysDept dept = r.getData();
+ map.put("orgName", dept.getOrgName());
+ map.put("legalPerson1", StrUtil.isNotEmpty(dept.getLegalPerson()) ? dept.getLegalPerson() : "");
+ map.put("entrustedAgent", StrUtil.isNotEmpty(dept.getLegalPerson()) ? "" : dept.getEntrustedAgent());
+ map.put("orgContact", dept.getOrgContact());
+ map.put("orgBank", dept.getOrgBank());
+ map.put("orgBankAccount", dept.getOrgBankAccount());
+
+ //鐢熸垚鏂囦欢鍚�
+ Long time = new Date().getTime();
+ // 鐢熸垚鐨剋ord鏍煎紡
+ String formatSuffix = ".docx";
+ // 鎷兼帴鍚庣殑鏂囦欢鍚�
+ String fileName = time + formatSuffix;//鏂囦欢鍚� 甯﹀悗缂�
+ //瀵煎嚭word
+ try {
+ // 1. 鍔犺浇妯$増
+ // 鍋囪妯$増鍦� resources/templates/template.docx
+ ClassPathResource resource = new ClassPathResource("template/jxc/jxcxsht.docx");
+ // 閰嶇疆鍒楄〃绛栫暐
+ Configure config = Configure.builder()
+ .bind("items", new LoopRowTableRenderPolicy()) // 灏� items 缁戝畾鍒拌寰幆绛栫暐
+ .build();
+ // 2. 缂栬瘧骞舵覆鏌撴暟鎹�
+ XWPFTemplate xwpfTemplate = XWPFTemplate.compile(resource.getInputStream(), config).render(map);
+
+ // 3. 璁剧疆鍝嶅簲澶�
+ response.setContentType("application/vnd.openxmlformats-officedocument.wordprocessingml.document");
+ response.setCharacterEncoding("utf-8");
+ response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".docx");
+
+ // 4. 鍐欏叆杈撳嚭娴�
+ OutputStream out = response.getOutputStream();
+ xwpfTemplate.write(out);
+ out.flush();
+ out.close();
+ xwpfTemplate.close(); // 閲嶈锛氬叧闂ā鐗堥噴鏀捐祫婧�
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
}
diff --git a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/MeterReadRecordServiceImpl.java b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/MeterReadRecordServiceImpl.java
index 90ac7f2..f219846 100644
--- a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/MeterReadRecordServiceImpl.java
+++ b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/MeterReadRecordServiceImpl.java
@@ -1,5 +1,7 @@
package com.by4cloud.platformx.business.service.impl;
+import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.ObjUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -12,6 +14,7 @@
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
+import java.util.List;
/**
* 姘寸數鎶勮〃
@@ -27,6 +30,7 @@
private final ContractSubjectMatterMapper contractSubjectMatterMapper;
private final ContractPaymentScheduleMapper contractPaymentScheduleMapper;
private final PaymentConfirmMapper paymentConfirmMapper;
+ private final ContractExecDateMapper contractExecDateMapper;
@Override
public R edit(MeterReadRecordUpdateDTO updateDTO) {
@@ -34,6 +38,12 @@
MeterReadRecord lastRecord = baseMapper.selectOne(Wrappers.<MeterReadRecord>lambdaQuery().eq(MeterReadRecord::getContractId,updateDTO.getContractId())
.eq(MeterReadRecord::getMeterReadCode,updateDTO.getMeterReadCode()).lt(MeterReadRecord::getCreateTime,record.getCreateTime())
.orderByDesc(MeterReadRecord::getCreateTime).last("limit 1"));
+ //鎴垮眿绉熻祦鐢熸垚搴旀敹
+ Contract contract = contractMapper.selectById(updateDTO.getContractId());
+ ContractSubjectMatter subjectMatter = contractSubjectMatterMapper.selectById(updateDTO.getMatterId());
+ if(ObjUtil.isNull(lastRecord)){
+ R.failed("鏃犲悎鍚屼俊鎭紝璇疯仈绯绘妧鏈汉鍛�");
+ }
if(ObjUtil.isNull(lastRecord)){
return R.failed("鏃犳渶杩戞妱琛ㄨ褰�");
}
@@ -42,25 +52,44 @@
}
record.setMeterReadTime(updateDTO.getMeterReadTime());
record.setMeterReadNum(updateDTO.getMeterReadNum());
+ record.setUsageNum(updateDTO.getMeterReadNum().subtract(lastRecord.getMeterReadNum()));
record.setMeterReadAttNames(updateDTO.getMeterReadAttNames());
record.setMeterReadAttPaths(updateDTO.getMeterReadAttPaths());
- baseMapper.updateById(record);
- //鎴垮眿绉熻祦鐢熸垚搴旀敹
- Contract contract = contractMapper.selectById(updateDTO.getContractId());
- ContractSubjectMatter subjectMatter = contractSubjectMatterMapper.selectById(updateDTO.getMatterId());
- if(ObjUtil.isNull(lastRecord)){
- R.failed("鏃犲悎鍚屼俊鎭紝璇疯仈绯绘妧鏈汉鍛�");
+ record.setUnitPrice(subjectMatter.getUnitPrice());
+ if (subjectMatter.getMaterialCode().equals("water_bill")){
+ record.setMeterType("2");
}
+ if (subjectMatter.getMaterialCode().equals("electricity_bill")){
+ record.setMeterType("3");
+ }
+ if (subjectMatter.getMaterialCode().equals("house_rental")){
+ record.setMeterType("1");
+ }
+ record.setCostAmount(subjectMatter.getUnitPrice().multiply(updateDTO.getMeterReadNum().subtract(lastRecord.getMeterReadNum())));
+ baseMapper.updateById(record);
+
//鍒涘缓鏀舵鑺傜偣
//鏌ヨ涓婃鏀舵鑺傜偣
ContractPaymentSchedule lastSchedule = contractPaymentScheduleMapper.selectOne(Wrappers.<ContractPaymentSchedule>lambdaQuery()
.eq(ContractPaymentSchedule::getContractId,contract.getId())
.orderByDesc(ContractPaymentSchedule::getCreateTime).last("limit 1"));
ContractPaymentSchedule schedule = new ContractPaymentSchedule();
- schedule.setStageName("姘寸數浠g即");
+
+ if (subjectMatter.getMaterialCode().equals("water_bill")){
+ schedule.setStageName("姘磋垂浠g即");
+ }
+ if (subjectMatter.getMaterialCode().equals("electricity_bill")){
+ schedule.setStageName("鐢佃垂浠g即");
+ }
+ if (subjectMatter.getMaterialCode().equals("house_rental")){
+ schedule.setStageName("鎴垮眿绉熻祦璐�");
+ }
schedule.setContractId(contract.getId());
schedule.setContractName(contract.getContractName());
- schedule.setPlannedAmount(subjectMatter.getUnitPrice().multiply(updateDTO.getMeterReadNum().subtract(lastRecord.getMeterReadNum())));
+ schedule.setPlannedAmount(record.getCostAmount());
+ schedule.setSubjectMatterCode(subjectMatter.getMaterialCode());
+ schedule.setSubjectMatterName(subjectMatter.getMaterialInternalName());
+ schedule.setRemark(DateUtil.formatDate(record.getMeterReadTime())+schedule.getStageName());
schedule.setEffectiveEndDate(updateDTO.getMeterReadTime());
schedule.setStageOrder(1);
if (ObjUtil.isNotNull(lastSchedule)){
@@ -68,6 +97,7 @@
}
schedule.setPaymentStatus(0);
schedule.setActualAmount(new BigDecimal("0"));
+ schedule.setInvoiceFlag("0");
contractPaymentScheduleMapper.insert(schedule);
//鎴垮眿绉熻祦鐢熸垚搴旀敹
PaymentConfirm confirm = new PaymentConfirm();
@@ -101,6 +131,30 @@
confirm.setCompId(contract.getCompId());
paymentConfirmMapper.insert(confirm);
}
+ //鍒ゆ柇 寰幆鏄惁瀹屾垚
+ List<ContractExecDate> execDateList = contractExecDateMapper.selectList(Wrappers.<ContractExecDate>lambdaQuery().eq(ContractExecDate::getContractId,contract.getId())
+ .eq(ContractExecDate::getGenFlag,"0"));
+ List<MeterReadRecord> recordList = baseMapper.selectList(Wrappers.<MeterReadRecord>lambdaQuery()
+ .eq(MeterReadRecord::getContractId,contract.getId())
+ .isNull(MeterReadRecord::getMeterReadNum));
+ if (ArrayUtil.isEmpty(execDateList.toArray())&&ArrayUtil.isEmpty(recordList.toArray())){
+ List<PaymentConfirm> confirmList = paymentConfirmMapper.selectList(Wrappers.<PaymentConfirm>lambdaQuery()
+ .eq(PaymentConfirm::getContractId, contract.getId())
+ .and(wrapper -> wrapper
+ .eq(PaymentConfirm::getBusinessType, "鎴垮眿绉熻祦搴旀敹")
+ .or()
+ .eq(PaymentConfirm::getBusinessType, "鍞數搴旀敹")
+ .or()
+ .eq(PaymentConfirm::getBusinessType, "涓嶅緛绋庤嚜鏉ユ按搴旀敹")
+ ));
+ if (ArrayUtil.isNotEmpty(confirmList.toArray())){
+ BigDecimal total = confirmList.stream().map(PaymentConfirm::getTransationAmount).filter(amount -> amount != null).reduce(BigDecimal.ZERO, BigDecimal::add);
+ contract.setAmount(total);
+ contractMapper.updateById(contract);
+ }
+ }
+ contract.setBillingStatus("2");
+ contractMapper.updateById(contract);
return R.ok();
}
}
\ No newline at end of file
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 05fb704..5f9b207 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
@@ -6,6 +6,7 @@
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.ObjUtil;
import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.by4cloud.platformx.business.dto.OutBoundAddDTO;
@@ -96,24 +97,24 @@
//褰撳墠鍏ュ簱鏍囩殑鐗�
Map<Long, Object> currentOutMap = new HashMap<>();
//鍑哄簱鎵规
- String batchNumber = DateUtil.format(new Date(), DatePattern.PURE_DATETIME_MS_PATTERN);
+// String batchNumber = DateUtil.format(new Date(), DatePattern.PURE_DATETIME_MS_PATTERN);
//鍑哄簱
addDTO.getSubjectMatterList().stream().forEach(outSubjectMatterAddDTO -> {
OutBound outBound = BeanUtil.copyProperties(outSubjectMatterAddDTO, OutBound.class);
if (StrUtil.equals(SecurityUtils.getUser().getCompId()+"",smj)){
- outBound.setBatchNumber(generateSMJContractNo());
+ outBound.setBatchNumber(generateSMJContractCKNo());
}
if (StrUtil.equals(SecurityUtils.getUser().getCompId()+"",sgb)){
- outBound.setBatchNumber(generateGYBContractNo());
+ outBound.setBatchNumber(generateGYBContractCKNo());
}
if (StrUtil.equals(SecurityUtils.getUser().getCompId()+"",ymj)){
- outBound.setBatchNumber(generateYMJContractNo());
+ outBound.setBatchNumber(generateYMJContractCKNo());
}
if (StrUtil.equals(SecurityUtils.getUser().getCompId()+"",tfgs)){
- outBound.setBatchNumber(generateTFContractNo());
+ outBound.setBatchNumber(generateTFContractCKNo());
}
if (StrUtil.equals(SecurityUtils.getUser().getCompId()+"",jxc)){
- outBound.setBatchNumber(generateJXCContractNo());
+ outBound.setBatchNumber(generateJXCContractCKNo());
}
outBound.setBusGuestName(addDTO.getBusGuestName());
outBound.setBusGuestId(addDTO.getBusGuestId());
@@ -201,12 +202,17 @@
//鍚堝悓閲戦
Contract contract = contractMapper.selectById(contractId);
//鍑哄簱鏄惁瀹屾垚
- if (outPirce.compareTo(contract.getAmount()) < 0) {
+ if (outPirce.compareTo(contract.getBillingAmout())>0) {
+ contract.setBillingStatus("2");
+ contractMapper.updateById(contract);
+ }
+ if (outPirce.compareTo(contract.getBillingAmout())==0) {
contract.setBillingStatus("1");
contractMapper.updateById(contract);
}
- if (outPirce.compareTo(contract.getAmount()) == 0) {
- contract.setBillingStatus("2");
+ if (outPirce.compareTo(contract.getAmount()) == 0&&
+ outPirce.compareTo(contract.getBillingAmout())==0) {
+ contract.setBillingStatus("3");
contractMapper.updateById(contract);
}
//璁$畻鍙戣揣鍓嶅簲鏀舵洿鏂拌祫閲戞槑缁�
@@ -412,11 +418,12 @@
contractOutBound.setBusGuestName(contract.getPartyA());
contractOutBound.setSubjectMatterCode(subjectMatter.getMaterialCode());
contractOutBound.setSubjectMatterName(subjectMatter.getMaterialInternalName());
- contractOutBound.setOutBoundTime(addDTO.getOutBoundTime());
+ contractOutBound.setOutBoundTime(ObjUtil.isNotNull(addDTO.getOutBoundTime())?addDTO.getOutBoundTime():new Date());
contractOutBound.setOutBoundNum(subjectMatter.getLastDeliveredQuantity());
contractOutBound.setOutBoundAttNames(addDTO.getOutBoundAttNames());
contractOutBound.setOutBoundAttPaths(addDTO.getOutBoundAttPaths());
contractOutBound.setOutBoundId(outBoundId);
+ contractOutBound.setLineNo(subjectMatter.getLineNo());
contractOutBound.setInvoiceStatus("0");
contractOutBound.setInvoiceNum(new BigDecimal("0"));
contractOutBoundMapper.insert(contractOutBound);
@@ -456,17 +463,70 @@
if (ArrayUtil.isEmpty(addDTO.getSubjectMatterList().toArray())) {
return R.failed("鍑哄簱鏍囩殑鐗╀笉鑳戒负绌�");
}
- Contract contract = contractMapper.selectOne(Wrappers.<Contract>lambdaQuery().eq(Contract::getContractNo, addDTO.getContractNo()).eq(Contract::getContractStatus, 2)
- .last("limit 1"));
+ // 1. 纭畾鏌ヨ鐢ㄧ殑鍚堝悓缂栧彿瀛楁鍊�
+ String targetContractNo = addDTO.getContractNo();
+ boolean isSgbAndEmptyOutbound = StrUtil.isEmpty(addDTO.getOutBoundType())
+ && StrUtil.equals(String.valueOf(SecurityUtils.getUser().getCompId()), sgb);
+
+ // 2. 鏋勫缓鏌ヨ鏉′欢
+ LambdaQueryWrapper<Contract> queryWrapper = Wrappers.lambdaQuery(Contract.class)
+ .eq(Contract::getContractStatus, 2)
+ .last("LIMIT 1"); // 娉ㄦ剰锛歭ast 娉ㄥ叆 SQL 鐗囨锛岄渶纭繚闃叉敞鍏ユ垨涓氬姟鍙帶
+
+ if (isSgbAndEmptyOutbound) {
+ // 鏉′欢 A: 浣跨敤 ERP 鍚堝悓鍙锋煡璇�
+ queryWrapper.eq(Contract::getErpContractNo, targetContractNo);
+ } else {
+ // 鏉′欢 B: 浣跨敤鏅�氬悎鍚屽彿鏌ヨ
+ queryWrapper.eq(Contract::getContractNo, targetContractNo);
+ }
+
+ // 3. 鎵ц鏌ヨ
+ Contract contract = contractMapper.selectOne(queryWrapper);
if (ObjUtil.isNull(contract)) {
return R.failed("鍚堝悓淇℃伅鏌ヨ澶辫触");
}
- //鍑哄簱鎵规
- String batchNumber = DateUtil.format(new Date(), DatePattern.PURE_DATETIME_MS_PATTERN);
+ //鍑哄簱鏁伴噺鏍¢獙
+ for (OutSubjectMatterAddDTO outSubjectMatterAddDTO: addDTO.getSubjectMatterList()) {
+ ContractSubjectMatter subjectMatter = contractSubjectMatterMapper.selectOne(Wrappers.<ContractSubjectMatter>lambdaQuery()
+ .eq(ContractSubjectMatter::getContractId,contract.getId())
+ .eq(ContractSubjectMatter::getMaterialCode,outSubjectMatterAddDTO.getSubjectMatterCode())
+ .eq(StrUtil.isNotEmpty(outSubjectMatterAddDTO.getLineNo()),ContractSubjectMatter::getLineNo,outSubjectMatterAddDTO.getLineNo())
+ .last("limit 1"));
+ if (ObjUtil.isNull(subjectMatter)){
+ continue;
+ }
+ if (outSubjectMatterAddDTO.getOutBoundNum().compareTo(new BigDecimal("0"))==0){
+ return R.failed(outSubjectMatterAddDTO.getSubjectMatterCode()+"鍑哄簱鏁伴噺涓嶈兘涓�0");
+ }
+ if (subjectMatter.getDeliveryStatus()==0){
+ if (outSubjectMatterAddDTO.getOutBoundNum().compareTo(subjectMatter.getQuantity())>0){
+ return R.failed(outSubjectMatterAddDTO.getSubjectMatterCode()+"鍑哄簱鏁颁笉鑳借秴杩囧悎鍚屼腑鏁伴噺");
+ }
+ }
+ if (subjectMatter.getDeliveryStatus()==1){
+ if (outSubjectMatterAddDTO.getOutBoundNum().compareTo(subjectMatter.getRemainingQuantity())>0){
+ return R.failed(outSubjectMatterAddDTO.getSubjectMatterCode()+"鍑哄簱鏁颁笉鑳借秴杩囨湭鍑哄簱鏁伴噺");
+ }
+ }
+ if (subjectMatter.getDeliveryStatus()==2){
+ return R.failed(outSubjectMatterAddDTO.getSubjectMatterCode()+"宸插嚭搴撳畬鎴愶紝涓嶈兘瓒呴鍑哄簱");
+ }
+ }
+
addDTO.getSubjectMatterList().stream().forEach(outSubjectMatterAddDTO -> {
- ContractSubjectMatter subjectMatter = contractSubjectMatterMapper.selectById(outSubjectMatterAddDTO.getId());
+ ContractSubjectMatter subjectMatter = contractSubjectMatterMapper.selectOne(Wrappers.<ContractSubjectMatter>lambdaQuery()
+ .eq(ContractSubjectMatter::getContractId,contract.getId())
+ .eq(ContractSubjectMatter::getMaterialCode,outSubjectMatterAddDTO.getSubjectMatterCode())
+ .ne(ContractSubjectMatter::getDeliveryStatus,2)
+ .eq(StrUtil.isNotEmpty(outSubjectMatterAddDTO.getLineNo()),ContractSubjectMatter::getLineNo,outSubjectMatterAddDTO.getLineNo())
+ .last("limit 1"));
+ if (ObjUtil.isNull(subjectMatter)){
+ return;
+ }
subjectMatter.setLastDeliveredQuantity(outSubjectMatterAddDTO.getOutBoundNum());
+ outSubjectMatterAddDTO.setUnitPrice(subjectMatter.getUnitPrice());
if (subjectMatter.getDeliveryStatus() == 0) {
subjectMatter.setDeliveredQuantity(outSubjectMatterAddDTO.getOutBoundNum());
subjectMatter.setRemainingQuantity(subjectMatter.getQuantity().subtract(outSubjectMatterAddDTO.getOutBoundNum()));
@@ -484,28 +544,32 @@
//
OutBound outBound = new OutBound();
if (StrUtil.equals(SecurityUtils.getUser().getCompId()+"",smj)){
- outBound.setBatchNumber(generateSMJContractNo());
+ outBound.setBatchNumber(generateSMJContractCKNo());
}
if (StrUtil.equals(SecurityUtils.getUser().getCompId()+"",sgb)){
- outBound.setBatchNumber(generateGYBContractNo());
+ outBound.setBatchNumber(generateGYBContractCKNo());
}
if (StrUtil.equals(SecurityUtils.getUser().getCompId()+"",ymj)){
- outBound.setBatchNumber(generateYMJContractNo());
+ outBound.setBatchNumber(generateYMJContractCKNo());
}
if (StrUtil.equals(SecurityUtils.getUser().getCompId()+"",tfgs)){
- outBound.setBatchNumber(generateTFContractNo());
+ outBound.setBatchNumber(generateTFContractCKNo());
}
if (StrUtil.equals(SecurityUtils.getUser().getCompId()+"",jxc)){
- outBound.setBatchNumber(generateJXCContractNo());
+ outBound.setBatchNumber(generateJXCContractCKNo());
}
outBound.setOutBoundNum(outSubjectMatterAddDTO.getOutBoundNum());
outBound.setOutBoundAttNames(addDTO.getOutBoundAttNames());
outBound.setOutBoundAttPaths(addDTO.getOutBoundAttPaths());
outBound.setBusGuestName(contract.getPartyA());
outBound.setBusGuestId(contract.getPartyAId());
- outBound.setOutBoundTime(addDTO.getOutBoundTime());
+ outBound.setOutBoundTime(ObjUtil.isNotNull(addDTO.getOutBoundTime())?addDTO.getOutBoundTime():new Date());
outBound.setSubjectMatterCode(outSubjectMatterAddDTO.getSubjectMatterCode());
outBound.setSubjectMatterName(outSubjectMatterAddDTO.getSubjectMatterName());
+ outBound.setOutBoundType("1");
+ if (StrUtil.isEmpty(addDTO.getOutBoundType())){
+ outBound.setOutBoundType("0");
+ }
baseMapper.insert(outBound);
//
saveContractOutBound(contract, addDTO, subjectMatter, outBound.getId());
@@ -523,12 +587,17 @@
.map(item -> (item.getDeliveryStatus() == 1 ? item.getDeliveredQuantity().multiply(item.getUnitPrice()) : item.getQuantity().multiply(item.getUnitPrice())))
.reduce(BigDecimal.ZERO, BigDecimal::add);
//鍑哄簱鏄惁瀹屾垚
- if (outPirce.compareTo(contract.getAmount()) < 0) {
+ if (outPirce.compareTo(contract.getBillingAmout())>0) {
+ contract.setBillingStatus("2");
+ contractMapper.updateById(contract);
+ }
+ if (outPirce.compareTo(contract.getBillingAmout())==0) {
contract.setBillingStatus("1");
contractMapper.updateById(contract);
}
- if (outPirce.compareTo(contract.getAmount()) == 0) {
- contract.setBillingStatus("2");
+ if (outPirce.compareTo(contract.getAmount()) == 0&&
+ outPirce.compareTo(contract.getBillingAmout())==0) {
+ contract.setBillingStatus("3");
contractMapper.updateById(contract);
}
//璁$畻鍙戣揣鍓嶅簲鏀舵洿鏂拌祫閲戞槑缁�
@@ -542,36 +611,31 @@
paymentConfirm.setScheduleId(schedule.getId());
paymentConfirm.setScheduleName(schedule.getStageName());
paymentConfirm.setConfirmTime(addDTO.getOutBoundTime());
- //鎸夊嚭搴撹祫閲戞瘮渚� 璁$畻鍙戣揣鍓嶅簲鏀�
- paymentConfirm.setTransationAmount(outPirce.divide(contract.getAmount(), 10, RoundingMode.HALF_UP).multiply(schedule.getPlannedAmount()));
- paymentConfirm.setReceivableAmount(paymentConfirm.getTransationAmount());
-
- //鏈�杩戝簲鏀�
+ //璁$畻鍑哄簱閲戦
+ BigDecimal outAmount = addDTO.getSubjectMatterList().stream().map(item->item.getUnitPrice().multiply(item.getOutBoundNum())).reduce(BigDecimal.ZERO, BigDecimal::add);
+ paymentConfirm.setTransationAmount(outAmount.divide(new BigDecimal("100")).multiply(schedule.getPaymentRatio()));
+ if (ObjUtil.isNotNull(contract.getOutBoundAmout())){
+ contract.setOutBoundAmout(outAmount.add(contract.getOutBoundAmout()));
+ }else {
+ contract.setOutBoundAmout(outAmount);
+ }
+ contractMapper.updateById(contract);
+ //鏈�杩戞槑缁�
PaymentConfirm lastConfirm = paymentConfirmMapper.selectOne(Wrappers.<PaymentConfirm>lambdaQuery().eq(PaymentConfirm::getContractId, contract.getId())
.orderByDesc(PaymentConfirm::getCreateTime).last("limit 1"));
-
if (ObjUtil.isNotNull(lastConfirm)) {
- //宸插瓨鍦ㄥ彂璐у簲鏀�
- if (StrUtil.equals(lastConfirm.getBusinessType(), paymentConfirm.getBusinessType())) {
-
- //鏌ヨ涔嬪墠鎵�鏈夊彂璐у墠搴旀敹
- List<PaymentConfirm> fhConfirmList = paymentConfirmMapper.selectList(Wrappers.<PaymentConfirm>lambdaQuery().eq(PaymentConfirm::getContractId, contract.getId())
- .eq(PaymentConfirm::getScheduleId, schedule.getId()).orderByDesc(PaymentConfirm::getCreateTime));
- BigDecimal fhTotalAmount = fhConfirmList.stream().map(item -> item.getTransationAmount()).reduce(BigDecimal.ZERO, BigDecimal::add);
- //鏈鍙戣揣鍓嶅簲鏀� 鍑哄簱鎬婚 - 鎵�鏈夊彂璐у墠搴旀敹
- paymentConfirm.setTransationAmount(paymentConfirm.getTransationAmount().subtract(fhTotalAmount));
- paymentConfirm.setReceivableAmount(paymentConfirm.getTransationAmount());
- paymentConfirm.setTotalAmount(lastConfirm.getTotalAmount().subtract(paymentConfirm.getTransationAmount()));
- if (schedule.getPaymentRatio().compareTo(new BigDecimal("0")) > 0) {
- paymentConfirmMapper.insert(paymentConfirm);
- }
- } else {
//涓嶅瓨鍦ㄥ彂璐у簲鏀� 鍑哄簱鎬婚
paymentConfirm.setTotalAmount(lastConfirm.getTotalAmount().subtract(paymentConfirm.getTransationAmount()));
+ if (paymentConfirm.getTotalAmount().compareTo(new BigDecimal("0"))>0){
+ paymentConfirm.setAdvanceAmount(paymentConfirm.getTotalAmount());
+ }
+ if (paymentConfirm.getTotalAmount().compareTo(new BigDecimal("0"))<0){
+ paymentConfirm.setReceivableAmount(paymentConfirm.getTotalAmount().multiply(new BigDecimal("-1")));
+ }
if (schedule.getPaymentRatio().compareTo(new BigDecimal("0")) > 0) {
paymentConfirmMapper.insert(paymentConfirm);
}
- }
+// }
} else {
//鏃犱箣鍓嶉樁娈靛簲鏀�
paymentConfirm.setTotalAmount(paymentConfirm.getTransationAmount().multiply(new BigDecimal("-1")));
@@ -628,21 +692,7 @@
//鏇存柊鍙戣揣鍓嶆敹娆剧敓鏁堟椂闂�
if (ObjUtil.isNull(schedule.getEffectiveDate())) {
- schedule.setEffectiveEndDate(DateUtil.offsetDay(addDTO.getOutBoundTime(), schedule.getAgreedDays()));
- //鏌ヨ鏄惁鏈夊悗缁樁娈�
-// List<ContractPaymentSchedule> afterSchedule = scheduleMapper.selectList(Wrappers.<ContractPaymentSchedule>lambdaQuery().eq(ContractPaymentSchedule::getContractId, contractId)
-// .gt(ContractPaymentSchedule::getStageOrder, schedule.getStageOrder()));
-// if (ArrayUtil.isEmpty(afterSchedule.toArray())) {
-// schedule.setEffectiveEndDate(contract.getExpirationDate());
-// }
- scheduleMapper.updateById(schedule);
- //鏌ヨ鏄惁鏈変箣鍓嶉樁娈�
-// ContractPaymentSchedule beforeSchedule = scheduleMapper.selectOne(Wrappers.<ContractPaymentSchedule>lambdaQuery().eq(ContractPaymentSchedule::getContractId, schedule.getContractId())
-// .lt(ContractPaymentSchedule::getStageOrder, schedule.getStageOrder()).orderByDesc(ContractPaymentSchedule::getCreateTime).last("limit 1"));
-// if (ObjUtil.isNotNull(beforeSchedule)) {
-// beforeSchedule.setEffectiveEndDate(schedule.getEffectiveDate());
-// scheduleMapper.updateById(beforeSchedule);
-// }
+
//鏇存柊灞ョ害
ContractPaymentScheduleProcess contractPaymentScheduleProcess = new ContractPaymentScheduleProcess();
contractPaymentScheduleProcess.setContractId(schedule.getContractId());
@@ -661,52 +711,16 @@
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()) && afterSchedule.size() == 1) {
- //鏈�鍚庨樁娈电敓鏁堟椂闂�
- ContractPaymentSchedule endSchedule = afterSchedule.get(0);
- if (StrUtil.equals(endSchedule.getStageName(), "璐ㄤ繚閲�")) {
-// endSchedule.setEffectiveEndDate(DateUtil.offsetDay(addDTO.getOutBoundTime(), endSchedule.getAgreedDays()));
-// scheduleMapper.updateById(endSchedule);
- //褰撳墠闃舵鐢熸晥鏃堕棿
-// schedule.setEffectiveEndDate(DateUtil.offsetDay(addDTO.getOutBoundTime(), schedule.getAgreedDays()));
-// scheduleMapper.updateById(schedule);
- //鏈�鍚庨樁娈靛簲鏀�
- PaymentConfirm newConfim = new PaymentConfirm();
- newConfim.setBusinessType(endSchedule.getStageName() + "搴旀敹");
- newConfim.setBusGuestId(contract.getPartyAId());
- newConfim.setBusGuestName(contract.getPartyA());
- newConfim.setContractId(contract.getId());
- newConfim.setContractName(contract.getContractName());
- newConfim.setContractNo(contract.getContractNo());
- newConfim.setScheduleId(endSchedule.getId());
- newConfim.setScheduleName(schedule.getStageName());
- newConfim.setConfirmTime(addDTO.getOutBoundTime());
- newConfim.setTransationAmount(endSchedule.getPlannedAmount());
- newConfim.setReceivableAmount(endSchedule.getPlannedAmount());
- PaymentConfirm lastNewConfirm = paymentConfirmMapper.selectOne(Wrappers.<PaymentConfirm>lambdaQuery().eq(PaymentConfirm::getContractId, contract.getId())
- .orderByDesc(PaymentConfirm::getCreateTime).last("limit 1"));
- BigDecimal lastNewTotal = new BigDecimal("0");
- if (ObjUtil.isNotNull(lastNewConfirm)) {
- lastNewTotal = lastNewConfirm.getTotalAmount();
- }
- newConfim.setTotalAmount(lastNewTotal.subtract(newConfim.getReceivableAmount()));
- if (endSchedule.getPaymentRatio().compareTo(new BigDecimal("0")) > 0) {
- paymentConfirmMapper.insert(newConfim);
- }
- }
- //鏇存柊鍚堝悓涓嬩釜闃舵
- contract.setNextScheduleName(endSchedule.getStageName());
- contractMapper.updateById(contract);
- }
- if (ArrayUtil.isNotEmpty(afterSchedule.toArray()) && afterSchedule.size() > 1) {
- //鏇存柊鍚堝悓涓嬩釜闃舵
+ if (ArrayUtil.isNotEmpty(afterSchedule.toArray())&&contract.getOutBoundAmout().compareTo(contract.getAmount())==0) {
contract.setNextScheduleName(afterSchedule.get(0).getStageName());
contractMapper.updateById(contract);
}
+
if (ArrayUtil.isEmpty(afterSchedule.toArray())) {
-// schedule.setEffectiveEndDate(contract.getExpirationDate());
-// scheduleMapper.updateById(schedule);
+ schedule.setEffectiveEndDate(contract.getExpirationDate());
+ scheduleMapper.updateById(schedule);
//鏇存柊鍚堝悓涓嬩釜闃舵
contract.setNextScheduleName("鏃�");
contractMapper.updateById(contract);
@@ -726,7 +740,7 @@
/**
* 鐢熸垚鏍煎紡涓�: yyyyMMdd + 4浣嶅簭鍒楀彿 (渚嬪: 20260629000001)
*/
- public String generateSMJContractNo() {
+ public String generateSMJContractCKNo() {
// 1. 鑾峰彇褰撳墠鏃ユ湡瀛楃涓�
String dateStr = DateUtil.format(new Date(), "yyyyMMdd");
@@ -744,7 +758,7 @@
return "ZB-SMJ-CK-"+dateStr + seqStr;
}
- public String generateYMJContractNo() {
+ public String generateYMJContractCKNo() {
// 1. 鑾峰彇褰撳墠鏃ユ湡瀛楃涓�
String dateStr = DateUtil.format(new Date(), "yyyyMMdd");
@@ -762,7 +776,7 @@
return "ZB-YMJ-CK-"+dateStr + seqStr;
}
- public String generateJXCContractNo() {
+ public String generateJXCContractCKNo() {
// 1. 鑾峰彇褰撳墠鏃ユ湡瀛楃涓�
String dateStr = DateUtil.format(new Date(), "yyyyMMdd");
@@ -780,7 +794,7 @@
return "ZB-JXC-CK-"+dateStr + seqStr;
}
- public String generateTFContractNo() {
+ public String generateTFContractCKNo() {
// 1. 鑾峰彇褰撳墠鏃ユ湡瀛楃涓�
String dateStr = DateUtil.format(new Date(), "yyyyMMdd");
@@ -798,7 +812,7 @@
return "ZB-TF-CK-"+dateStr + seqStr;
}
- public String generateGYBContractNo() {
+ public String generateGYBContractCKNo() {
// 1. 鑾峰彇褰撳墠鏃ユ湡瀛楃涓�
String dateStr = DateUtil.format(new Date(), "yyyyMMdd");
@@ -815,4 +829,65 @@
// 5. 鎷兼帴杩斿洖
return "ZB-GYB-CK-"+dateStr + seqStr;
}
+
+ @Override
+ public R delOutBound(String batchNumber) {
+ List<OutBound> outBoundList = baseMapper.selectList(Wrappers.<OutBound>lambdaQuery().eq(OutBound::getBatchNumber,batchNumber));
+ if (ArrayUtil.isEmpty(outBoundList)){
+ return R.failed("鍑哄簱淇℃伅寮傚父锛岃鑱旂郴钀ラ攢绯荤粺绠$悊浜哄憳");
+ }
+ List<ContractOutBound> contractOutBoundList = contractOutBoundMapper.selectList(Wrappers.<ContractOutBound>lambdaQuery()
+ .in(ContractOutBound::getOutBoundId,outBoundList.stream().map(OutBound::getId).collect(Collectors.toList())));
+ if (ArrayUtil.isEmpty(contractOutBoundList)){
+ return R.failed("鍑哄簱淇℃伅寮傚父锛岃鑱旂郴钀ラ攢绯荤粺绠$悊浜哄憳");
+ }
+ boolean allZero = true;
+ for (ContractOutBound item : contractOutBoundList) {
+ // 鍋囪 invoiceNum 鏄� Integer 瀵硅薄
+ if (item.getInvoiceNum() == null || item.getInvoiceNum().compareTo(new BigDecimal("0"))!=0) {
+ allZero = false;
+ break; // 鍙戠幇涓�涓笉绗﹀悎鍗抽��鍑�
+ }
+ }
+ if (!allZero){
+ return R.failed("璇峰厛鍐插噺鎵�鏈夎摑鐗屽悗鍦ㄦ搷浣�");
+ }
+ for (ContractOutBound item : contractOutBoundList) {
+ ContractSubjectMatter subjectMatter = contractSubjectMatterMapper.selectOne(Wrappers.<ContractSubjectMatter>lambdaQuery()
+ .eq(ContractSubjectMatter::getContractId,item.getContractId()).eq(ContractSubjectMatter::getMaterialCode,item.getSubjectMatterCode())
+ .eq(ContractSubjectMatter::getLineNo,item.getLineNo()));
+ if (ObjUtil.isNotNull(subjectMatter)){
+ subjectMatter.setDeliveredQuantity(subjectMatter.getDeliveredQuantity().subtract(item.getOutBoundNum()));
+ subjectMatter.setRemainingQuantity(subjectMatter.getRemainingQuantity().add(item.getOutBoundNum()));
+ if (subjectMatter.getDeliveredQuantity().compareTo(new BigDecimal("0"))==0){
+ subjectMatter.setDeliveryStatus(0);
+ }
+ if (subjectMatter.getDeliveredQuantity().compareTo(new BigDecimal("0"))>0){
+ subjectMatter.setDeliveryStatus(1);
+ }
+ //鏍囩殑鐗╂洿鏂�
+ contractSubjectMatterMapper.updateById(subjectMatter);
+ }
+ //鍚堝悓寮�绁ㄧ姸鎬佹洿鏂�
+// List<ContractSubjectMatter> subjectMatterList = contractSubjectMatterMapper.selectList(Wrappers.<ContractSubjectMatter>lambdaQuery()
+// .eq(ContractSubjectMatter::getContractId,subjectMatter.getContractId()));
+// if (subjectMatterList.stream().allMatch(matter -> matter.getDeliveryStatus() != null && matter.getDeliveryStatus() == 0)){
+// Contract contract = contractMapper.selectById(subjectMatter.getContractId());
+// if (ObjUtil.isNotNull(contract)){
+// contract.setBillingStatus("1");
+// contractMapper.updateById(contract);
+// }
+// }else {
+// Contract contract = contractMapper.selectById(subjectMatter.getContractId());
+// if (ObjUtil.isNotNull(contract)){
+// contract.setBillingStatus("1");
+// contractMapper.updateById(contract);
+// }
+// }
+ //鍑哄簱璁板綍鍒犻櫎
+ contractOutBoundMapper.deleteById(item);
+ }
+ baseMapper.delete(Wrappers.<OutBound>lambdaQuery().eq(OutBound::getBatchNumber,batchNumber));
+ return R.ok();
+ }
}
\ No newline at end of file
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 b8d58e8..43eec9f 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
@@ -62,6 +62,7 @@
private final PaymentSlipMapper paymentSlipMapper;
private final BipRequestRecordMapper bipRequestRecordMapper;
private final ContractExecDateMapper contractExecDateMapper;
+ private final MeterReadRecordMapper meterReadRecordMapper;
private final RemoteDeptService remoteDeptService;
private final RedisTemplate redisTemplate;
@@ -141,57 +142,61 @@
entity.setConfirmTime(new Date());
baseMapper.insert(entity);
}
- //鏇存柊浠樻闃舵浠樻
- 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 = addDTO.getTransationAmount();
- 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(addDTO.getConfirmTime());
- 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(addDTO.getConfirmTime());
- historyOverdue.setCompId(schedule.getCompId());
- historyOverdueMapper.insert(historyOverdue);
- //鍒犻櫎褰撳墠閫炬湡
- currentOverdueMapper.deleteById(currentOverdue);
+
+ //鏇存柊浠樻闃舵浠樻
+ 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 = addDTO.getTransationAmount();
+ 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(addDTO.getConfirmTime());
+ 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(addDTO.getConfirmTime());
+ 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(addDTO.getConfirmTime());
+ 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(addDTO.getConfirmTime());
+ historyOverdue.setCompId(schedule.getCompId());
+ historyOverdueMapper.insert(historyOverdue);
+ //鏇存柊褰撳墠閫炬湡
+ currentOverdue.setReceivableAmount(schedule.getPlannedAmount().subtract(schedule.getActualAmount()));
+ currentOverdueMapper.updateById(currentOverdue);
+ }
+ break;
}
- } else {
- schedule.setActualAmount(StrUtil.equals(schedule.getPaymentStatus() + "", "0") ? schedule.getPlannedAmount().add(remain) :
- schedule.getActualAmount().add(lastRemain));
- schedule.setPaymentDate(addDTO.getConfirmTime());
- 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(addDTO.getConfirmTime());
- historyOverdue.setCompId(schedule.getCompId());
- historyOverdueMapper.insert(historyOverdue);
- //鏇存柊褰撳墠閫炬湡
- currentOverdue.setReceivableAmount(schedule.getPlannedAmount().subtract(schedule.getActualAmount()));
- currentOverdueMapper.updateById(currentOverdue);
- }
- break;
}
}
}
+ //闈炴埧灞嬬璧� 姘寸數
+ if (!StrUtil.equals(contract.getContractCategory(), "water_house")) {
//鏇存柊鍚堝悓宸蹭粯娆�
BigDecimal paid = new BigDecimal("0");
if (ObjUtil.isNotNull(contract.getPaidAmount())) {
@@ -199,10 +204,31 @@
}
paid = paid.add(addDTO.getTransationAmount());
contract.setPaidAmount(paid);
- if (paid.compareTo(contract.getAmount()) > 0) {
+ if (paid.compareTo(contract.getAmount()) == 0) {
+ contract.setContractStatus(3);
contract.setPaidAmount(contract.getAmount());
}
contractService.updateById(contract);
+ }else {
+ List<ContractExecDate> execDateList = contractExecDateMapper.selectList(Wrappers.<ContractExecDate>lambdaQuery().eq(ContractExecDate::getContractId,contract.getId())
+ .eq(ContractExecDate::getGenFlag,"0"));
+ List<MeterReadRecord> recordList = meterReadRecordMapper.selectList(Wrappers.<MeterReadRecord>lambdaQuery()
+ .eq(MeterReadRecord::getContractId,contract.getId())
+ .isNull(MeterReadRecord::getMeterReadNum));
+ if (ArrayUtil.isEmpty(execDateList.toArray())&&ArrayUtil.isEmpty(recordList.toArray())){
+ //鏇存柊鍚堝悓宸蹭粯娆�
+ BigDecimal paid = new BigDecimal("0");
+ if (ObjUtil.isNotNull(contract.getPaidAmount())) {
+ paid = contract.getPaidAmount();
+ }
+ paid = paid.add(addDTO.getTransationAmount());
+ contract.setPaidAmount(paid);
+ if (contract.getAmount().compareTo(new BigDecimal("0"))==0&&paid.compareTo(contract.getAmount()) >= 0) {
+ contract.setContractStatus(3);
+ contract.setPaidAmount(contract.getAmount());
+ }
+ contractService.updateById(contract);
+ }
}
//杞嚭
if (StrUtil.equals(addDTO.getInOrOut(), "2")) {
@@ -227,209 +253,203 @@
entity.setConfirmTime(new Date());
baseMapper.insert(entity);
}
- // 鏌ヨ鎵�鏈変粯娆鹃樁娈垫槸鍚﹂兘浠樻瀹屾垚
- List<ContractPaymentSchedule> scheduleList = contractPaymentScheduleMapper.selectList(Wrappers.<ContractPaymentSchedule>lambdaQuery().eq(ContractPaymentSchedule::getContractId, contract.getId()));
- if (ArrayUtil.isNotEmpty(scheduleList.toArray())) {
- if (scheduleList.stream().allMatch(item -> Objects.equals(item.getPaymentStatus(), 2))) {
- contract.setContractStatus(3);
- contractService.updateById(contract);
- }
- ;
- }
- }else {
- List<Contract> customerContractList = contractService.list(Wrappers.<Contract>lambdaQuery().eq(Contract::getPartyAId, addDTO.getBusGuestId())
- .eq(Contract::getPartyBId,SecurityUtils.getUser().getCompId()).orderByAsc(Contract::getCreateTime).apply(" amount != paid_amount"));
- if (ArrayUtil.isEmpty(customerContractList.toArray())) {
- return R.failed("涓烘煡璇㈠埌鏈粯娆惧悎鍚�");
- }
- BusinessCustomer customer = businessCustomerService.getOne(Wrappers.<BusinessCustomer>lambdaQuery()
- .eq(StrUtil.isNotBlank(addDTO.getBusGuestName()), BusinessCustomer::getRegisterName, addDTO.getBusGuestName())
- .eq(ObjUtil.isNotNull(addDTO.getBusGuestId()), BusinessCustomer::getId, addDTO.getBusGuestId())
- .last("limit 1"));
- if (ObjUtil.isNull(customer)) {
- return R.failed("瀹㈠晢鏌ヨ澶辫触");
- }
- //鏂板浠樻鍗�
- PaymentSlip slip = new PaymentSlip();
- slip.setBusGuestId(customer.getId());
- slip.setBusGuestName(customer.getRegisterName());
- slip.setPayeeCompId(SecurityUtils.getUser().getCompId());
- slip.setPaymentTime(addDTO.getConfirmTime());
- slip.setPaymentAmount(addDTO.getTransationAmount());
- slip.setPayType(addDTO.getPayType());
- paymentSlipMapper.insert(slip);
-
- BigDecimal transtionAmount = addDTO.getTransationAmount();
- //鍓╀綑浠樻
- 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 = addDTO.getConfirmTime();
- Iterator<Contract> iterator = customerContractList.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();
- }else {
-
- }
-
- //鍚堝悓鏈�杩戞槑缁嗘�婚涓�0 鎴� > 0 鎯呭喌涓�
- if (lastTotal.compareTo(new BigDecimal("0")) >= 0) {
- log.info("褰撳墠鍚堝悓鍙凤細{},鏄庣粏鎬婚鏃犲簲鏀舵", contract.getContractNo());
- advanceContractList.add(contract);
- if (iterator.hasNext()) {
- 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("瀹㈡埛浠樻");
- 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);
- payContractList.add(contract);
- } 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);
- payContractList.add(contract);
- break;
- } else {
- entity.setTransationAmount(transtionRemainAmount.subtract(lastTotal));
- entity.setReceivableAmount(transtionRemainAmount.multiply(new BigDecimal("-1")));
- entity.setTotalAmount(transtionRemainAmount);
- entity.setConfirmTime(payDate);
- baseMapper.insert(entity);
- payContractList.add(contract);
- 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 = lastRemain.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() + "", "2") ? 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);
+ }
+// else {
+//
+// List<Contract> customerContractList = contractService.list(Wrappers.<Contract>lambdaQuery().eq(Contract::getPartyAId, addDTO.getBusGuestId())
+// .eq(Contract::getPartyBId, SecurityUtils.getUser().getCompId()).orderByAsc(Contract::getCreateTime)
+// .apply(" ((contract_category != 'water_house' and amount != paid_amount) or contract_category = 'water_house')"));
+// if (ArrayUtil.isEmpty(customerContractList.toArray())) {
+// return R.failed("涓烘煡璇㈠埌鏈粯娆惧悎鍚�");
+// }
+// BusinessCustomer customer = businessCustomerService.getOne(Wrappers.<BusinessCustomer>lambdaQuery()
+// .eq(StrUtil.isNotBlank(addDTO.getBusGuestName()), BusinessCustomer::getRegisterName, addDTO.getBusGuestName())
+// .eq(ObjUtil.isNotNull(addDTO.getBusGuestId()), BusinessCustomer::getId, addDTO.getBusGuestId())
+// .last("limit 1"));
+// if (ObjUtil.isNull(customer)) {
+// return R.failed("瀹㈠晢鏌ヨ澶辫触");
+// }
+// //鏂板浠樻鍗�
+// PaymentSlip slip = new PaymentSlip();
+// slip.setBusGuestId(customer.getId());
+// slip.setBusGuestName(customer.getRegisterName());
+// slip.setPayeeCompId(SecurityUtils.getUser().getCompId());
+// slip.setPaymentTime(addDTO.getConfirmTime());
+// slip.setPaymentAmount(addDTO.getTransationAmount());
+// slip.setPayType(addDTO.getPayType());
+// paymentSlipMapper.insert(slip);
+//
+// BigDecimal transtionAmount = addDTO.getTransationAmount();
+// //鍓╀綑浠樻
+// 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 = addDTO.getConfirmTime();
+// Iterator<Contract> iterator = customerContractList.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();
+// } else {
+//
+// }
+//
+// //鍚堝悓鏈�杩戞槑缁嗘�婚涓�0 鎴� > 0 鎯呭喌涓�
+// if (lastTotal.compareTo(new BigDecimal("0")) >= 0) {
+// log.info("褰撳墠鍚堝悓鍙凤細{},鏄庣粏鎬婚鏃犲簲鏀舵", contract.getContractNo());
+// advanceContractList.add(contract);
+// if (iterator.hasNext()) {
+// continue;
// }
- 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.toArray())){
- 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);
- }
-
- }
- });
+// }
+//
+// 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("瀹㈡埛浠樻");
+// 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);
+// payContractList.add(contract);
+// } 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);
+// payContractList.add(contract);
+// break;
+// } else {
+// entity.setTransationAmount(transtionRemainAmount.subtract(lastTotal));
+// entity.setReceivableAmount(transtionRemainAmount.multiply(new BigDecimal("-1")));
+// entity.setTotalAmount(transtionRemainAmount);
+// entity.setConfirmTime(payDate);
+// baseMapper.insert(entity);
+// payContractList.add(contract);
+// 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 = lastRemain.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() + "", "2") ? 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);
+//// }
+// if (contract.getAmount().compareTo(contract.getPaidAmount()) == 0) {
+//
+// 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.toArray())) {
+// 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) {
@@ -454,7 +474,7 @@
//
// }
// }
- }
+// }
return R.ok();
}
@@ -484,7 +504,7 @@
String result = HttpUtil.post(url + "/yonbip/EFI/collection/list?access_token=" + finalAccessToken, params.toJSONString());
log.info("SK_CX Response:{}", result);
//淇濆瓨璇锋眰璁板綍
- saveBipRequestRecord(params,"<XSJZ_SK_CX_001>-鏀舵鍗曟煡璇㈡帴鍙�", result);
+ saveBipRequestRecord(params, "<XSJZ_SK_CX_001>-鏀舵鍗曟煡璇㈡帴鍙�", result);
JSONObject resultJson = JSONObject.parseObject(result);
if (resultJson.containsKey("code") && resultJson.getString("code").equals("200")) {
handleAndSave(bipCode, resultJson);
@@ -495,7 +515,7 @@
return R.ok();
}
- private JSONObject genParams(String bipCode){
+ private JSONObject genParams(String bipCode) {
JSONObject params = new JSONObject();
params.put("pageIndex", 1);
params.put("pageSize", 999);
@@ -601,8 +621,8 @@
return;
}
//淇濆瓨浠樻鍗�
- Boolean codeFlag = savePaymentSlip(customer,record,dept);
- if (codeFlag){
+ Boolean codeFlag = savePaymentSlip(customer, record, dept);
+ if (codeFlag) {
log.error("浠樻鍗昳d锛歿},浠樻鍗曞凡瀛樺湪");
return;
}
@@ -659,7 +679,7 @@
entity.setTransationAmount(transtionRemainAmount.subtract(lastTotal));
entity.setAdvanceAmount(transtionRemainAmount);
entity.setTotalAmount(transtionRemainAmount);
- }else {
+ } else {
entity.setTransationAmount(lastTotal.multiply(new BigDecimal("-1")));
entity.setTotalAmount(new BigDecimal("0"));
}
@@ -736,11 +756,11 @@
}
//鍚堝悓鎵�鏈変粯娆鹃樁娈�
List<ContractPaymentSchedule> payComScheduleList = contractPaymentScheduleMapper.selectList(Wrappers.<ContractPaymentSchedule>lambdaQuery()
- .eq(ContractPaymentSchedule::getContractId, contract.getId()).ne(ContractPaymentSchedule::getPaymentStatus, 0).ne(ContractPaymentSchedule::getPaymentStatus,3)
+ .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);
+ 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);
@@ -750,7 +770,7 @@
// payCompleteContractList.add(contract);
// }
if (contract.getAmount().compareTo(contract.getPaidAmount()) == 0) {
- contract.setBillingStatus("2");
+// contract.setBillingStatus("2");
contract.setContractStatus(3);
payCompleteContractList.add(contract);
}
@@ -758,18 +778,18 @@
if (contract.getAmount().compareTo(contract.getPaidAmount()) > 0) {
payNoCompleteContractList.add(contract);
}
- if (StrUtil.isNotEmpty(contract.getContractCategory())&&StrUtil.equals(contract.getContractCategory(),"water_house")){
+ 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)){
+ .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))) {
+ if (ArrayUtil.isNotEmpty(contractPaymentScheduleList.toArray()) && contractPaymentScheduleList.stream().allMatch(item -> Objects.equals(item.getPaymentStatus(), 2))) {
contract.setContractStatus(3);
contractService.updateById(contract);
}
}
- }else {
+ } else {
contractService.updateById(contract);
}
}
@@ -800,19 +820,19 @@
// }
}
- private Boolean savePaymentSlip(BusinessCustomer customer, JSONObject record,SysDept dept) {
+ 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.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()));
+ PaymentSlip paymentSlip = paymentSlipMapper.selectOne(Wrappers.<PaymentSlip>lambdaQuery().eq(PaymentSlip::getPaymentNumber, slip.getPaymentNumber()));
if (ObjUtil.isNull(paymentSlip)) {
paymentSlipMapper.insert(slip);
return false;
@@ -821,8 +841,8 @@
return true;
}
- public void saveNewPaymentConfirm(BusinessCustomer customer,JSONObject record,Contract contract,BigDecimal transtionRemainAmount
- ,Date payDate){
+ 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());
@@ -842,7 +862,7 @@
entity.setBusGuestId(customer.getId());
entity.setBusGuestName(customer.getRegisterName());
entity.setBusinessType("瀹㈡埛浠樻");
- if (ObjUtil.isNotNull(record)){
+ 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);
@@ -851,9 +871,9 @@
entity.setConfirmTime(payDate);
entity.setTransationAmount(transtionRemainAmount);
entity.setTotalAmount(transtionRemainAmount.add(lastTotal));
- if (entity.getTotalAmount().compareTo(new BigDecimal("0"))>0){
+ if (entity.getTotalAmount().compareTo(new BigDecimal("0")) > 0) {
entity.setAdvanceAmount(entity.getTotalAmount());
- }else if (entity.getTotalAmount().compareTo(new BigDecimal("0"))<0){
+ } else if (entity.getTotalAmount().compareTo(new BigDecimal("0")) < 0) {
entity.setReceivableAmount(entity.getTotalAmount().multiply(new BigDecimal("-1")));
}
baseMapper.insert(entity);
@@ -862,63 +882,63 @@
@Override
public R queryAllBusinessType() {
return R.ok(baseMapper.selectList(Wrappers.<PaymentConfirm>lambdaQuery().select(PaymentConfirm::getBusinessType).isNotNull(PaymentConfirm::getBusinessType)
- .groupBy(PaymentConfirm::getBusinessType)).stream().map(PaymentConfirm::getBusinessType).collect(Collectors.toList()));
+ .groupBy(PaymentConfirm::getBusinessType)).stream().map(PaymentConfirm::getBusinessType).collect(Collectors.toList()));
}
@Override
public R queryAging() {
- List<AgingCompanyVo> companys = contractPaymentScheduleMapper.selectAgingCompany(null,DataScope.of("comp_id"));
- if (ArrayUtil.isEmpty(companys.toArray())){
+ List<AgingCompanyVo> companys = contractPaymentScheduleMapper.selectAgingCompany(null, DataScope.of("comp_id"));
+ if (ArrayUtil.isEmpty(companys.toArray())) {
return R.failed("鏆傛棤璐﹂緞");
}
List<AgingAnalysisVo> result = new ArrayList<>();
AgingQueryDTO queryDTO = new AgingQueryDTO();
List<AgingVo> agingVoList = contractPaymentScheduleMapper.selectAgingTotal(null);
- companys.stream().forEach(company->{
+ companys.stream().forEach(company -> {
BusinessCustomer businessCustomer = businessCustomerService.getById(company.getCompanyId());
AgingAnalysisVo agingAnalysisVo = new AgingAnalysisVo();
agingAnalysisVo.setCompanyName(businessCustomer.getCompanyName());
queryDTO.setCompanyId(company.getCompanyId());
List<AgingVo> companyAgingVo = contractPaymentScheduleMapper.selectAgingTotal(queryDTO);
//琛ュ叏鏁版嵁
- if (ArrayUtil.isEmpty(companyAgingVo.toArray())){
+ 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("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 {
+ } 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ if (!ArrayUtil.contains(overdueRanges.toArray(), "1骞翠互涓�")) {
+ AgingVo agingVo6 = new AgingVo("1骞翠互涓�", new BigDecimal("0"), null);
companyAgingVo.add(agingVo6);
}
}
@@ -947,7 +967,7 @@
if (agingAnalysisVo.getAmount().get(i) == null || agingAnalysisVo.getAmount().get(i).compareTo(BigDecimal.ZERO) == 0) {
return null;
- }else {
+ } else {
return new BigDecimal("100");
}
})
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 30ff48c..b10fb15 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
@@ -136,7 +136,7 @@
paid = paid.add(paymentOffset.getOffsetAmount());
contract.setPaidAmount(paid);
if (paid.compareTo(contract.getAmount())==0){
- contract.setBillingStatus("2");
+// contract.setBillingStatus("2");
contract.setContractStatus(3);
}
contractService.updateById(contract);
diff --git a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/PaymentSlipServiceImpl.java b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/PaymentSlipServiceImpl.java
index c20cbf0..bf19c13 100644
--- a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/PaymentSlipServiceImpl.java
+++ b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/PaymentSlipServiceImpl.java
@@ -6,6 +6,7 @@
import com.by4cloud.platformx.business.entity.PaymentSlip;
import com.by4cloud.platformx.business.mapper.PaymentSlipMapper;
import com.by4cloud.platformx.business.service.PaymentSlipService;
+import com.by4cloud.platformx.common.core.util.R;
import com.by4cloud.platformx.common.data.datascope.DataScope;
import org.springframework.stereotype.Service;
@@ -15,4 +16,5 @@
public Page pageScope(Page page, PaymentSlipQueryDTO queryDTO) {
return baseMapper.pageScope(page,queryDTO, DataScope.of("comp_id"));
}
+
}
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 0956a6f..93c519e 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
@@ -552,34 +552,73 @@
@Override
public R agingAnalysis(AnalysisCommonDTO commonDTO) {
if (commonDTO.getAgingType().equals("2")) {
- AgingQueryDTO queryDTO = new AgingQueryDTO();
- List<AgingCompanyVo> companys = contractPaymentScheduleMapper.selectAgingCompanyShip(DataScope.of("comp_id"));
-
- if (ArrayUtil.isEmpty(companys.toArray())) {
- return R.failed("鏆傛棤璐﹂緞");
- }
- //鍚堣鏁版嵁
- List<AgingVo> agingVoList = contractPaymentScheduleMapper.selectAgingTotalShip(queryDTO);
- agingVoList = completeData(agingVoList);
- List<AgingVo> finalAgingVoList = agingVoList;
+ 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<>();
-
- companys.stream().forEach(company -> {
- BusinessCustomer businessCustomer = businessCustomerMapper.selectById(company.getCompanyId());
+ AgingQueryDTO queryDTO = new AgingQueryDTO();
+ List<AgingVo> agingVoList = contractPaymentScheduleMapper.selectAgingTotalShip(null);
+ compIds.stream().forEach(compId->{
+ R<SysDept> r = remoteDeptService.getById(compId);
+ if (!r.isOk()){
+ return;
+ }
+ SysDept dept = r.getData();
AgingAnalysisVo agingAnalysisVo = new AgingAnalysisVo();
- agingAnalysisVo.setCompanyName(businessCustomer.getCompanyName());
- queryDTO.setCompanyId(company.getCompanyId());
+ agingAnalysisVo.setCompanyName(dept.getOrgName());
+ queryDTO.setCompanyId(dept.getDeptId());
List<AgingVo> companyAgingVo = contractPaymentScheduleMapper.selectAgingTotalShip(queryDTO);
//琛ュ叏鏁版嵁
- companyAgingVo = completeData(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);
+ }
+ }
agingAnalysisVo.setAmount(companyAgingVo.stream().map(AgingVo::getTotalAmount).collect(Collectors.toList()));
List<AgingVo> finalCompanyAgingVo = companyAgingVo;
-
- agingAnalysisVo.setPercent(IntStream.range(0, finalAgingVoList.size())
+ agingAnalysisVo.setPercent(IntStream.range(0, agingVoList.size())
.mapToObj(i -> {
BigDecimal part = finalCompanyAgingVo.get(i).getTotalAmount();
- BigDecimal total = finalAgingVoList.get(i).getTotalAmount();
+ BigDecimal total = agingVoList.get(i).getTotalAmount();
if (total == null || total.compareTo(BigDecimal.ZERO) == 0) {
return null;
}
@@ -599,7 +638,7 @@
if (agingAnalysisVo.getAmount().get(i) == null || agingAnalysisVo.getAmount().get(i).compareTo(BigDecimal.ZERO) == 0) {
return null;
- } else {
+ }else {
return new BigDecimal("100");
}
})
@@ -609,33 +648,73 @@
return R.ok(result);
}
if (commonDTO.getAgingType().equals("3")) {
- AgingQueryDTO queryDTO = new AgingQueryDTO();
- List<AgingCompanyVo> companys = contractPaymentScheduleMapper.selectAgingCompanyInvoice(DataScope.of("comp_id"));
- if (ArrayUtil.isEmpty(companys.toArray())) {
- return R.failed("鏆傛棤璐﹂緞");
- }
- //鍚堣鏁版嵁
- List<AgingVo> agingVoList = contractPaymentScheduleMapper.selectAgingTotalInvoice(queryDTO);
- agingVoList = completeData(agingVoList);
- List<AgingVo> finalAgingVoList = agingVoList;
+ 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<>();
-
- companys.stream().forEach(company -> {
- BusinessCustomer businessCustomer = businessCustomerMapper.selectById(company.getCompanyId());
+ AgingQueryDTO queryDTO = new AgingQueryDTO();
+ List<AgingVo> agingVoList = contractPaymentScheduleMapper.selectAgingTotalInvoice(null);
+ compIds.stream().forEach(compId->{
+ R<SysDept> r = remoteDeptService.getById(compId);
+ if (!r.isOk()){
+ return;
+ }
+ SysDept dept = r.getData();
AgingAnalysisVo agingAnalysisVo = new AgingAnalysisVo();
- agingAnalysisVo.setCompanyName(businessCustomer.getCompanyName());
- queryDTO.setCompanyId(company.getCompanyId());
+ agingAnalysisVo.setCompanyName(dept.getOrgName());
+ queryDTO.setCompanyId(dept.getDeptId());
List<AgingVo> companyAgingVo = contractPaymentScheduleMapper.selectAgingTotalInvoice(queryDTO);
//琛ュ叏鏁版嵁
- companyAgingVo = completeData(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);
+ }
+ }
agingAnalysisVo.setAmount(companyAgingVo.stream().map(AgingVo::getTotalAmount).collect(Collectors.toList()));
List<AgingVo> finalCompanyAgingVo = companyAgingVo;
-
- agingAnalysisVo.setPercent(IntStream.range(0, finalAgingVoList.size())
+ agingAnalysisVo.setPercent(IntStream.range(0, agingVoList.size())
.mapToObj(i -> {
BigDecimal part = finalCompanyAgingVo.get(i).getTotalAmount();
- BigDecimal total = finalAgingVoList.get(i).getTotalAmount();
+ BigDecimal total = agingVoList.get(i).getTotalAmount();
if (total == null || total.compareTo(BigDecimal.ZERO) == 0) {
return null;
}
@@ -655,7 +734,7 @@
if (agingAnalysisVo.getAmount().get(i) == null || agingAnalysisVo.getAmount().get(i).compareTo(BigDecimal.ZERO) == 0) {
return null;
- } else {
+ }else {
return new BigDecimal("100");
}
})
diff --git a/platformx-business-finance-biz/src/main/resources/mapper/ContractInvoiceMapper.xml b/platformx-business-finance-biz/src/main/resources/mapper/ContractInvoiceMapper.xml
index a1eecf0..767a077 100644
--- a/platformx-business-finance-biz/src/main/resources/mapper/ContractInvoiceMapper.xml
+++ b/platformx-business-finance-biz/src/main/resources/mapper/ContractInvoiceMapper.xml
@@ -564,7 +564,7 @@
t.comp_id,
t1.contract_no,
t2.company_name AS busGuestName,
- t1.partyB
+ t1.party_b
FROM
contract_invoice t
LEFT JOIN contract t1 ON ( t1.id = t.contract_id AND t1.del_flag = '0' )
@@ -608,4 +608,89 @@
ORDER BY
t.create_time DESC
</select>
+ <select id="pageScope" resultType="com.by4cloud.platformx.business.vo.ContractInvoicePageVo">
+ SELECT
+ id,
+ contract_no,
+ contract_name,
+ party_a_id,
+ party_a,
+ party_b_id,
+ party_b,
+ amount,
+ currency,
+ contract_type,
+ supply_attribute,
+ contract_status,
+ contract_attribute,
+ sign_date,
+ sign_place,
+ effective_date,
+ delivery_cycle,
+ expiration_date,
+ attachment_url,
+ remark,
+ parent_id,
+ approve_time,
+ arrival_schedule_id,
+ accept_schedule_id,
+ warranty_schedule_id,
+ erp_push_flag,
+ billing_status,
+ billing_amout,
+ next_schedule_name,
+ template_id,
+ sales_model,
+ paid_amount,
+ contract_category,
+ exec_frequency,
+ exec_times,
+ exec_day,
+ environment,
+ standard,
+ use_month,
+ after_ship_month,
+ ship_method,
+ ship_address,
+ packaging,
+ repair_period,
+ repair_breach_amount,
+ goods_short,
+ goods_short_breach_amount,
+ overdue_breach_amount,
+ terminate_contract,
+ court,
+ contract_attchment,
+ city,
+ region,
+ invoice_notice,
+ contract_tax,
+ economic_matters,
+ erp_contract_no,
+ data_id,
+ industry_code,
+ area_code,
+ create_by,
+ update_by,
+ create_time,
+ update_time,
+ del_flag,
+ comp_id,
+ (select count(1) from contract_invoice ci where ci.del_flag = '0' and ci.contract_id = c.id) invoiceNum
+ FROM
+ contract c
+ WHERE
+ del_flag = '0'
+ <if test="queryDTO.contractNo !=null and queryDTO.contractNo !=''">
+ AND contract_no LIKE CONCAT('%', #{queryDTO.contractNo}, '%')
+ </if>
+ <if test="queryDTO.partyA !=null and queryDTO.partyA !=''">
+ AND party_a LIKE CONCAT('%', #{queryDTO.partyA}, '%')
+ </if>
+ <if test="queryDTO.billingStatus !=null and queryDTO.billingStatus !=''">
+ AND billing_status = #{queryDTO.billingStatus}
+ </if>
+ ORDER BY
+ create_time ASC
+ </select>
</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 12793f6..baaff55 100644
--- a/platformx-business-finance-biz/src/main/resources/mapper/ContractMapper.xml
+++ b/platformx-business-finance-biz/src/main/resources/mapper/ContractMapper.xml
@@ -434,19 +434,17 @@
<select id="contractAmountAnalysisByIndustry"
resultType="com.by4cloud.platformx.business.vo.ContractIncomeAnalysisAreaVo">
SELECT
- b.industry_id area_id,
+ c.industry_code area_id,
SUM( CASE WHEN c.party_b_id = #{sgbCompId} THEN c.amount ELSE 0 END ) AS sgbze,
ROUND(
SUM( CASE WHEN c.party_b_id = #{sgbCompId} THEN c.amount ELSE 0 END ) / (
SELECT
SUM( amount )
FROM
- contract c, business_customer bc
- WHERE
- bc.id = c.party_a_id
- and c.del_flag = '0'
- and bc.del_flag = '0'
- and bc.industry_id = b.industry_id
+ contract c1
+ where
+ c1.del_flag = '0'
+ and c1.industry_code = c.industry_code
and party_b_id IN
<foreach collection="compIds" item="id" open="(" close=")" separator=",">
#{id}
@@ -460,12 +458,10 @@
SELECT
SUM( amount )
FROM
- contract c, business_customer bc
- WHERE
- bc.id = c.party_a_id
- and c.del_flag = '0'
- and bc.del_flag = '0'
- and bc.industry_id = b.industry_id
+ contract c1
+ where
+ c1.del_flag = '0'
+ and c1.industry_code = c.industry_code
and party_b_id IN
<foreach collection="compIds" item="id" open="(" close=")" separator=",">
#{id}
@@ -479,12 +475,10 @@
SELECT
SUM( amount )
FROM
- contract c, business_customer bc
- WHERE
- bc.id = c.party_a_id
- and c.del_flag = '0'
- and bc.del_flag = '0'
- and bc.industry_id = b.industry_id
+ contract c1
+ where
+ c1.del_flag = '0'
+ and c1.industry_code = c.industry_code
and party_b_id IN
<foreach collection="compIds" item="id" open="(" close=")" separator=",">
#{id}
@@ -498,12 +492,10 @@
SELECT
SUM( amount )
FROM
- contract c, business_customer bc
- WHERE
- bc.id = c.party_a_id
- and c.del_flag = '0'
- and bc.del_flag = '0'
- and bc.industry_id = b.industry_id
+ contract c1
+ where
+ c1.del_flag = '0'
+ and c1.industry_code = c.industry_code
and party_b_id IN
<foreach collection="compIds" item="id" open="(" close=")" separator=",">
#{id}
@@ -517,12 +509,10 @@
SELECT
SUM( amount )
FROM
- contract c, business_customer bc
- WHERE
- bc.id = c.party_a_id
- and c.del_flag = '0'
- and bc.del_flag = '0'
- and bc.industry_id = b.industry_id
+ contract c1
+ where
+ c1.del_flag = '0'
+ and c1.industry_code = c.industry_code
and party_b_id IN
<foreach collection="compIds" item="id" open="(" close=")" separator=",">
#{id}
@@ -532,12 +522,11 @@
) AS tfzb
FROM
contract c
- JOIN business_customer b ON c.party_a_id = b.id
- WHERE
- b.industry_id IS NOT NULL
+ where
+ c.industry_code is not null
AND YEAR ( sign_date ) = #{queryDTO.year}
GROUP BY
- b.industry_id
+ c.industry_code
</select>
<select id="contractAmountAnalysisByMarket"
@@ -1063,6 +1052,8 @@
c.paid_amount,
c.contract_category,
c.exec_frequency,
+ c.next_schedule_name,
+ c.warranty_schedule_id,
c.comp_id,
(select sum(delivered_quantity*unit_price) from contract_subject_matter csm where csm.contract_id = c.id) outAmount
FROM
@@ -1559,4 +1550,22 @@
AND c.sign_date >= DATE_FORMAT( CURDATE(), '%Y-01-01' )
AND c.sign_date < DATE_FORMAT( DATE_ADD( CURDATE(), INTERVAL 1 YEAR ), '%Y-01-01' )) hwbn
</select>
+ <select id="fourAssociation" resultType="com.by4cloud.platformx.business.vo.FourAssociationPageVo">
+ SELECT
+ c.id,
+ c.contract_no,
+ c.sign_date,
+ c.amount,
+ c.paid_amount,
+ c.billing_amout,
+ c.comp_id
+ FROM
+ contract c
+ where
+ c.del_flag = '0'
+ and c.contract_status = 2
+ order by
+ c.create_time
+
+ </select>
</mapper>
\ No newline at end of file
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 c3364b2..8f0d3dc 100644
--- a/platformx-business-finance-biz/src/main/resources/mapper/ContractPaymentScheduleMapper.xml
+++ b/platformx-business-finance-biz/src/main/resources/mapper/ContractPaymentScheduleMapper.xml
@@ -87,7 +87,7 @@
and bc.area_id = #{queryDTO.areaId}
</if>
<if test="queryDTO.industryId !=null">
- and bc.industry_id = #{queryDTO.industryId}
+ and c.industry_code = #{queryDTO.industryId}
</if>
<if test="queryDTO.classId !=null">
and bc.class_id = #{queryDTO.classId}
@@ -169,7 +169,7 @@
c.del_flag = '0'
AND c.amount > c.paid_amount
<if test="queryDTO.companyId !=null">
- and c.party_a_id = #{queryDTO.companyId}
+ and c.party_b_id = #{queryDTO.companyId}
</if>
AND EXISTS ( SELECT 1 FROM contract_out_bound cob WHERE cob.del_flag = '0' AND cob.contract_id = c.id )
GROUP BY
@@ -215,13 +215,13 @@
LEFT JOIN contract c ON c.del_flag = '0'
AND DATEDIFF(
CURRENT_DATE,
- ( SELECT max( out_bound_time ) FROM contract_out_bound cob WHERE cob.del_flag = '0' AND cob.contract_id = c.id ORDER BY out_bound_time ASC )) BETWEEN ranges.min_days
+ ( SELECT max( invoice_time ) FROM contract_invoice ci WHERE ci.del_flag = '0' AND ci.contract_id = c.id ORDER BY invoice_time ASC )) BETWEEN ranges.min_days
AND ranges.max_days
WHERE
c.del_flag = '0'
AND c.amount > c.paid_amount
<if test="queryDTO.companyId !=null">
- and c.party_a_id = #{queryDTO.companyId}
+ and c.party_b_id = #{queryDTO.companyId}
</if>
AND EXISTS ( SELECT 1 FROM contract_invoice ci WHERE ci.del_flag = '0' AND ci.contract_id = c.id)
GROUP 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 79d31c8..9798fe4 100644
--- a/platformx-business-finance-biz/src/main/resources/mapper/DeliveryOverdueMapper.xml
+++ b/platformx-business-finance-biz/src/main/resources/mapper/DeliveryOverdueMapper.xml
@@ -52,7 +52,7 @@
and t2.area_id = #{queryDTO.areaId}
</if>
<if test="queryDTO.industryId !=null and queryDTO.industryId !=''">
- and t2.industry_id = #{queryDTO.industryId}
+ and t1.industry_code = #{queryDTO.industryId}
</if>
<if test="queryDTO.partyB !=null and queryDTO.partyB !=''">
and t1.party_b LIKE CONCAT('%', #{queryDTO.partyB}, '%')
diff --git a/platformx-business-finance-biz/src/main/resources/template/jxc/jxcxsht.docx b/platformx-business-finance-biz/src/main/resources/template/jxc/jxcxsht.docx
new file mode 100644
index 0000000..790130b
--- /dev/null
+++ b/platformx-business-finance-biz/src/main/resources/template/jxc/jxcxsht.docx
Binary files differ
diff --git a/platformx-business-finance-biz/src/main/resources/template/jxc/product.xlsx b/platformx-business-finance-biz/src/main/resources/template/jxc/product.xlsx
new file mode 100644
index 0000000..8da08ab
--- /dev/null
+++ b/platformx-business-finance-biz/src/main/resources/template/jxc/product.xlsx
Binary files differ
diff --git a/platformx-business-finance-biz/src/main/resources/template/smj/smjgypmmht.docx b/platformx-business-finance-biz/src/main/resources/template/smj/smjgypmmht.docx
new file mode 100644
index 0000000..592b021
--- /dev/null
+++ b/platformx-business-finance-biz/src/main/resources/template/smj/smjgypmmht.docx
Binary files differ
diff --git a/platformx-business-finance-biz/src/main/resources/template/ymj/ymjgypmmht.docx b/platformx-business-finance-biz/src/main/resources/template/ymj/ymjgypmmht.docx
index 4e8c502..e9bd82c 100644
--- a/platformx-business-finance-biz/src/main/resources/template/ymj/ymjgypmmht.docx
+++ b/platformx-business-finance-biz/src/main/resources/template/ymj/ymjgypmmht.docx
Binary files differ
--
Gitblit v1.9.1