赵士淞
2023-02-08 62676c33ff868ff46b7d34c223546d11e2a2cf3e
Merge branch 'zhaoss' of http://192.168.1.110:5678/r/pms-upgrade into master

# Conflicts:
# eladmin-web-master/src/utils/constant.js
58 files added
4 files modified
6978 ■■■■■ changed files
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/constant/Constant.java 31 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/domain/Contract.java 138 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/domain/ContractFirst.java 85 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/domain/ContractInvoice.java 86 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/domain/ContractInvoicePayment.java 57 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/domain/ContractPayment.java 82 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/domain/ContractSecond.java 85 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/repository/ContractFirstRepository.java 28 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/repository/ContractInvoicePaymentRepository.java 54 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/repository/ContractInvoiceRepository.java 48 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/repository/ContractPaymentRepository.java 66 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/repository/ContractRepository.java 121 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/repository/ContractSecondRepository.java 28 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/rest/ContractController.java 159 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/rest/ContractFirstController.java 95 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/rest/ContractInvoiceController.java 96 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/rest/ContractInvoicePaymentController.java 95 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/rest/ContractPaymentController.java 96 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/rest/ContractSecondController.java 95 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/service/ContractFirstService.java 83 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/service/ContractInvoicePaymentService.java 83 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/service/ContractInvoiceService.java 83 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/service/ContractPaymentService.java 83 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/service/ContractSecondService.java 83 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/service/ContractService.java 141 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/service/dto/ContractDto.java 132 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/service/dto/ContractFirstDto.java 62 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/service/dto/ContractFirstQueryCriteria.java 33 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/service/dto/ContractInvoiceDto.java 70 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/service/dto/ContractInvoicePaymentDto.java 41 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/service/dto/ContractInvoicePaymentQueryCriteria.java 29 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/service/dto/ContractInvoiceQueryCriteria.java 37 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/service/dto/ContractPaymentDto.java 67 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/service/dto/ContractPaymentQueryCriteria.java 37 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/service/dto/ContractQueryCriteria.java 71 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/service/dto/ContractSecondDto.java 62 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/service/dto/ContractSecondQueryCriteria.java 33 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/service/impl/ContractFirstServiceImpl.java 113 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/service/impl/ContractInvoicePaymentServiceImpl.java 147 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/service/impl/ContractInvoiceServiceImpl.java 168 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/service/impl/ContractPaymentServiceImpl.java 201 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/service/impl/ContractSecondServiceImpl.java 113 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/service/impl/ContractServiceImpl.java 973 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/service/mapstruct/ContractFirstMapper.java 32 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/service/mapstruct/ContractInvoiceMapper.java 32 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/service/mapstruct/ContractInvoicePaymentMapper.java 32 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/service/mapstruct/ContractMapper.java 32 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/service/mapstruct/ContractPaymentMapper.java 32 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/service/mapstruct/ContractSecondMapper.java 32 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-tools/src/main/java/me/zhengjie/rest/LocalStorageController.java 4 ●●●●● patch | view | raw | blame | history
eladmin-web-master/src/api/contract/contract.js 92 ●●●●● patch | view | raw | blame | history
eladmin-web-master/src/api/contract/contractFirst.js 35 ●●●●● patch | view | raw | blame | history
eladmin-web-master/src/api/contract/contractInvoice.js 35 ●●●●● patch | view | raw | blame | history
eladmin-web-master/src/api/contract/contractPayment.js 35 ●●●●● patch | view | raw | blame | history
eladmin-web-master/src/api/contract/contractSecond.js 35 ●●●●● patch | view | raw | blame | history
eladmin-web-master/src/components/Crud/crud.js 14 ●●●●● patch | view | raw | blame | history
eladmin-web-master/src/utils/constant.js 34 ●●●●● patch | view | raw | blame | history
eladmin-web-master/src/views/contract/contract/index.vue 890 ●●●●● patch | view | raw | blame | history
eladmin-web-master/src/views/contract/contractFirst/index.vue 203 ●●●●● patch | view | raw | blame | history
eladmin-web-master/src/views/contract/contractInvoice/index.vue 368 ●●●●● patch | view | raw | blame | history
eladmin-web-master/src/views/contract/contractPayment/index.vue 348 ●●●●● patch | view | raw | blame | history
eladmin-web-master/src/views/contract/contractSecond/index.vue 203 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/constant/Constant.java
@@ -219,6 +219,37 @@
    // 公示状态:已公示
    public static final String PUBLICITY_STATUS_YES = "publicity_status_yes";
    // 发票类型
    public static final String INVOICE_TYPE = "invoice_type";
    // 款项类型
    public static final String FUND_TYPE = "fund_type";
    // 款项类型:合同费
    public static final String FUND_CONTRACT = "fund_contract";
    // 款项类型:服务费
    public static final String FUND_SERVICE = "fund_service";
    // 合同类型
    public static final String CONTRACT_TYPE = "contract_type";
    // 合同类型:开发合同
    public static final String CONTRACT_DEVELOP = "contract_develop";
    // 合同类型:服务合同(年)
    public static final String CONTRACT_SERVICE = "contract_service";
    // 合同类型:开发服务合同
    public static final String CONTRACT_DEVELOP_SERVICE = "contract_develop_service";
    // 付款状态
    public static final String PAYMENT_STATE = "payment_state";
    // 付款状态:未付款
    public static final String PAYMENT_NOT = "payment_not";
    // 付款状态:部分付款
    public static final String PAYMENT_PART = "payment_part";
    // 付款状态:已付款
    public static final String PAYMENT_ALREADY = "payment_already";
    // 合同状态
    public static final String CONTRACT_STATUS = "contract_status";
    // key iv
    public static final String key = "1234567890123456";
    public static final String iv = "1234567890123456";
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/domain/Contract.java
New file
@@ -0,0 +1,138 @@
/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.modules.contract.domain;
import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.copier.CopyOptions;
import me.zhengjie.base.BaseEntity;
import javax.persistence.*;
import javax.validation.constraints.*;
import java.sql.Timestamp;
import java.math.BigDecimal;
import java.io.Serializable;
/**
* @website https://eladmin.vip
* @description /
* @author 赵士淞
* @date 2023-02-02
**/
@Entity
@Data
@Table(name="contract")
public class Contract extends BaseEntity implements Serializable {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "`contract_id`")
    @ApiModelProperty(value = "ID")
    private Long contractId;
    @Column(name = "`contract_number`")
    @ApiModelProperty(value = "合同编号")
    private String contractNumber;
    @Column(name = "`contract_name`")
    @ApiModelProperty(value = "合同名称")
    private String contractName;
    @Column(name = "`first_id`")
    @ApiModelProperty(value = "甲方信息ID")
    private Long firstId;
    @Column(name = "`second_id`")
    @ApiModelProperty(value = "乙方信息ID")
    private Long secondId;
    @Column(name = "`sign_date`")
    @ApiModelProperty(value = "签订日期")
    private Timestamp signDate;
    @Column(name = "`start_date`")
    @ApiModelProperty(value = "起始日期")
    private Timestamp startDate;
    @Column(name = "`end_date`")
    @ApiModelProperty(value = "截止日期")
    private Timestamp endDate;
    @Column(name = "`contract_area_code`")
    @ApiModelProperty(value = "合同所属地区编码")
    private String contractAreaCode;
    @Column(name = "`contract_area`")
    @ApiModelProperty(value = "合同所属地区")
    private String contractArea;
    @Column(name = "`contract_type`")
    @ApiModelProperty(value = "合同类型")
    private String contractType;
    @Column(name = "`contract_content`")
    @ApiModelProperty(value = "合同内容")
    private String contractContent;
    @Column(name = "`contract_amount`")
    @ApiModelProperty(value = "合同费金额")
    private BigDecimal contractAmount;
    @Column(name = "`contract_payment_date`")
    @ApiModelProperty(value = "预计付款日期")
    private Timestamp contractPaymentDate;
    @Column(name = "`contract_payment_state`")
    @ApiModelProperty(value = "付款状态")
    private String contractPaymentState;
    @Column(name = "`service_starts_date`")
    @ApiModelProperty(value = "服务开始日期")
    private Timestamp serviceStartsDate;
    @Column(name = "`service_amount`")
    @ApiModelProperty(value = "服务费金额")
    private BigDecimal serviceAmount;
    @Column(name = "`service_payment_date`")
    @ApiModelProperty(value = "预计付款日期")
    private Timestamp servicePaymentDate;
    @Column(name = "`service_payment_state`")
    @ApiModelProperty(value = "付款状态")
    private String servicePaymentState;
    @Column(name = "`related_documents_first`")
    @ApiModelProperty(value = "合同初版文件")
    private String relatedDocumentsFirst;
    @Column(name = "`related_documents_final`")
    @ApiModelProperty(value = "合同终版文件")
    private String relatedDocumentsFinal;
    @Column(name = "`contract_status`")
    @ApiModelProperty(value = "合同状态")
    private String contractStatus;
    @Column(name = "`remarks`")
    @ApiModelProperty(value = "备注信息")
    private String remarks;
    public void copy(Contract source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/domain/ContractFirst.java
New file
@@ -0,0 +1,85 @@
/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.modules.contract.domain;
import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.copier.CopyOptions;
import me.zhengjie.base.BaseEntity;
import javax.persistence.*;
import javax.validation.constraints.*;
import java.sql.Timestamp;
import java.io.Serializable;
/**
* @website https://eladmin.vip
* @description /
* @author 赵士淞
* @date 2023-02-02
**/
@Entity
@Data
@Table(name="contract_first")
public class ContractFirst extends BaseEntity implements Serializable {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "`first_id`")
    @ApiModelProperty(value = "ID")
    private Long firstId;
    @Column(name = "`first_name`")
    @ApiModelProperty(value = "甲方名称")
    private String firstName;
    @Column(name = "`first_person`")
    @ApiModelProperty(value = "甲方联系人")
    private String firstPerson;
    @Column(name = "`first_phone`")
    @ApiModelProperty(value = "甲方联系电话")
    private String firstPhone;
    @Column(name = "`first_email`")
    @ApiModelProperty(value = "甲方邮件")
    private String firstEmail;
    @Column(name = "`first_fax`")
    @ApiModelProperty(value = "甲方传真")
    private String firstFax;
    @Column(name = "`first_area_code`")
    @ApiModelProperty(value = "甲方所在地区编码")
    private String firstAreaCode;
    @Column(name = "`first_area`")
    @ApiModelProperty(value = "甲方所在地区")
    private String firstArea;
    @Column(name = "`first_address`")
    @ApiModelProperty(value = "甲方详细地址")
    private String firstAddress;
    @Column(name = "`remarks`")
    @ApiModelProperty(value = "备注信息")
    private String remarks;
    public void copy(ContractFirst source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/domain/ContractInvoice.java
New file
@@ -0,0 +1,86 @@
/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.modules.contract.domain;
import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.copier.CopyOptions;
import me.zhengjie.base.BaseEntity;
import javax.persistence.*;
import javax.validation.constraints.*;
import java.sql.Timestamp;
import java.math.BigDecimal;
import java.io.Serializable;
/**
* @website https://eladmin.vip
* @description /
* @author 赵士淞
* @date 2023-02-02
**/
@Entity
@Data
@Table(name="contract_invoice")
public class ContractInvoice extends BaseEntity implements Serializable {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "`invoice_id`")
    @ApiModelProperty(value = "ID")
    private Long invoiceId;
    @Column(name = "`contract_id`")
    @ApiModelProperty(value = "合同ID")
    private Long contractId;
    @Column(name = "`billing_time`")
    @ApiModelProperty(value = "开票时间")
    private Timestamp billingTime;
    @Column(name = "`invoice_type`")
    @ApiModelProperty(value = "发票类型")
    private String invoiceType;
    @Column(name = "`before_tax_amount`")
    @ApiModelProperty(value = "税前金额")
    private BigDecimal beforeTaxAmount;
    @Column(name = "`tax_rate`")
    @ApiModelProperty(value = "税率")
    private Double taxRate;
    @Column(name = "`tax_amount`")
    @ApiModelProperty(value = "税额")
    private BigDecimal taxAmount;
    @Column(name = "`after_tax_amount`")
    @ApiModelProperty(value = "税后金额")
    private BigDecimal afterTaxAmount;
    @Column(name = "`related_documents`")
    @ApiModelProperty(value = "相关文件")
    private String relatedDocuments;
    @Column(name = "`remarks`")
    @ApiModelProperty(value = "备注信息")
    private String remarks;
    public void copy(ContractInvoice source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/domain/ContractInvoicePayment.java
New file
@@ -0,0 +1,57 @@
/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.modules.contract.domain;
import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.copier.CopyOptions;
import me.zhengjie.base.BaseEntity;
import javax.persistence.*;
import javax.validation.constraints.*;
import java.sql.Timestamp;
import java.io.Serializable;
/**
* @website https://eladmin.vip
* @description /
* @author 赵士淞
* @date 2023-02-02
**/
@Entity
@Data
@Table(name="contract_invoice_payment")
public class ContractInvoicePayment extends BaseEntity implements Serializable {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "`relation_id`")
    @ApiModelProperty(value = "ID")
    private Long relationId;
    @Column(name = "`invoice_id`")
    @ApiModelProperty(value = "发票ID")
    private Long invoiceId;
    @Column(name = "`payment_id`")
    @ApiModelProperty(value = "付款ID")
    private Long paymentId;
    public void copy(ContractInvoicePayment source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/domain/ContractPayment.java
New file
@@ -0,0 +1,82 @@
/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.modules.contract.domain;
import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.copier.CopyOptions;
import me.zhengjie.base.BaseEntity;
import javax.persistence.*;
import javax.validation.constraints.*;
import java.sql.Timestamp;
import java.math.BigDecimal;
import java.io.Serializable;
/**
* @website https://eladmin.vip
* @description /
* @author 赵士淞
* @date 2023-02-02
**/
@Entity
@Data
@Table(name="contract_payment")
public class ContractPayment extends BaseEntity implements Serializable {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "`payment_id`")
    @ApiModelProperty(value = "ID")
    private Long paymentId;
    @Column(name = "`contract_id`")
    @ApiModelProperty(value = "合同ID")
    private Long contractId;
    @Column(name = "`payment_time`")
    @ApiModelProperty(value = "付款时间")
    private Timestamp paymentTime;
    @Column(name = "`fund_type`")
    @ApiModelProperty(value = "款项类型")
    private String fundType;
    @Column(name = "`payment_amount`")
    @ApiModelProperty(value = "付款金额")
    private BigDecimal paymentAmount;
    @Column(name = "`fund_belong`")
    @ApiModelProperty(value = "款项内容")
    private String fundBelong;
    @Column(name = "`fund_belong_start`")
    @ApiModelProperty(value = "款项起始日期")
    private Timestamp fundBelongStart;
    @Column(name = "`fund_belong_end`")
    @ApiModelProperty(value = "款项结束日期")
    private Timestamp fundBelongEnd;
    @Column(name = "`remarks`")
    @ApiModelProperty(value = "备注信息")
    private String remarks;
    public void copy(ContractPayment source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/domain/ContractSecond.java
New file
@@ -0,0 +1,85 @@
/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.modules.contract.domain;
import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.copier.CopyOptions;
import me.zhengjie.base.BaseEntity;
import javax.persistence.*;
import javax.validation.constraints.*;
import java.sql.Timestamp;
import java.io.Serializable;
/**
* @website https://eladmin.vip
* @description /
* @author 赵士淞
* @date 2023-02-02
**/
@Entity
@Data
@Table(name="contract_second")
public class ContractSecond extends BaseEntity implements Serializable {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "`second_id`")
    @ApiModelProperty(value = "ID")
    private Long secondId;
    @Column(name = "`second_name`")
    @ApiModelProperty(value = "乙方名称")
    private String secondName;
    @Column(name = "`second_person`")
    @ApiModelProperty(value = "乙方联系人")
    private String secondPerson;
    @Column(name = "`second_phone`")
    @ApiModelProperty(value = "乙方联系电话")
    private String secondPhone;
    @Column(name = "`second_email`")
    @ApiModelProperty(value = "乙方邮件")
    private String secondEmail;
    @Column(name = "`second_fax`")
    @ApiModelProperty(value = "乙方传真")
    private String secondFax;
    @Column(name = "`second_area_code`")
    @ApiModelProperty(value = "乙方所在地区编码")
    private String secondAreaCode;
    @Column(name = "`second_area`")
    @ApiModelProperty(value = "乙方所在地区")
    private String secondArea;
    @Column(name = "`second_address`")
    @ApiModelProperty(value = "乙方详细地址")
    private String secondAddress;
    @Column(name = "`remarks`")
    @ApiModelProperty(value = "备注信息")
    private String remarks;
    public void copy(ContractSecond source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/repository/ContractFirstRepository.java
New file
@@ -0,0 +1,28 @@
/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.modules.contract.repository;
import me.zhengjie.modules.contract.domain.ContractFirst;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
/**
* @website https://eladmin.vip
* @author 赵士淞
* @date 2023-02-02
**/
public interface ContractFirstRepository extends JpaRepository<ContractFirst, Long>, JpaSpecificationExecutor<ContractFirst> {
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/repository/ContractInvoicePaymentRepository.java
New file
@@ -0,0 +1,54 @@
/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.modules.contract.repository;
import me.zhengjie.modules.contract.domain.ContractInvoicePayment;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import java.util.List;
/**
* @website https://eladmin.vip
* @author 赵士淞
* @date 2023-02-02
**/
public interface ContractInvoicePaymentRepository extends JpaRepository<ContractInvoicePayment, Long>, JpaSpecificationExecutor<ContractInvoicePayment> {
    /**
     * 查询付款相关发票数据
     * @return
     */
    List<ContractInvoicePayment> findByPaymentId(Long paymentId);
    /**
     * 删除付款相关发票数据
     * @return
     */
    void deleteByPaymentId(Long paymentId);
    /**
     * 查询发票相关发票数据
     * @return
     */
    List<ContractInvoicePayment> findByInvoiceId(Long invoiceId);
    /**
     * 删除发票相关发票数据
     * @return
     */
    void deleteByInvoiceId(Long invoiceId);
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/repository/ContractInvoiceRepository.java
New file
@@ -0,0 +1,48 @@
/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.modules.contract.repository;
import me.zhengjie.modules.contract.domain.ContractInvoice;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import java.math.BigDecimal;
import java.util.List;
/**
* @website https://eladmin.vip
* @author 赵士淞
* @date 2023-02-02
**/
public interface ContractInvoiceRepository extends JpaRepository<ContractInvoice, Long>, JpaSpecificationExecutor<ContractInvoice> {
    /**
     * 查询合同发票数据
     * @param contractId
     * @return
     */
    @Query(value = "SELECT * FROM contract_invoice WHERE contract_id = ?1",nativeQuery = true)
    List<ContractInvoice> findByContractId(Long contractId);
    /**
     * 统计合同发票总金额
     * @param contractId
     * @return
     */
    @Query(value = "SELECT SUM(after_tax_amount) AS totalAmount FROM contract_invoice WHERE contract_id = ?1",nativeQuery = true)
    BigDecimal countTotalAmountByContractId(Long contractId);
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/repository/ContractPaymentRepository.java
New file
@@ -0,0 +1,66 @@
/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.modules.contract.repository;
import me.zhengjie.modules.contract.domain.ContractPayment;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import java.math.BigDecimal;
import java.util.List;
/**
* @website https://eladmin.vip
* @author 赵士淞
* @date 2023-02-02
**/
public interface ContractPaymentRepository extends JpaRepository<ContractPayment, Long>, JpaSpecificationExecutor<ContractPayment> {
    /**
     * 查询合同各款项付款金额
     * @param contractId
     * @param fundType
     * @return
     */
    @Query(value = "SELECT SUM(payment_amount) AS totalAmount FROM contract_payment WHERE contract_id = ?1 AND fund_type = ?2",nativeQuery = true)
    BigDecimal findByContractIdAndFundType(Long contractId, String fundType);
    /**
     * 查询合同服务款项各年度付款金额
     * @param contractId
     * @param fundBelongStart
     * @return
     */
    @Query(value = "SELECT SUM(payment_amount) AS totalAmount FROM contract_payment WHERE fund_type = 'fund_service' AND contract_id = ?1 AND fund_belong_start LIKE concat(?2,'%')",nativeQuery = true)
    BigDecimal findByContractIdAndFundBelongStart(Long contractId, Integer fundBelongStart);
    /**
     * 查询合同付款数据
     * @param contractId
     * @return
     */
    @Query(value = "SELECT * FROM contract_payment WHERE contract_id = ?1",nativeQuery = true)
    List<ContractPayment> findByContractId(Long contractId);
    /**
     * 统计合同付款总金额
     * @param contractId
     * @return
     */
    @Query(value = "SELECT SUM(payment_amount) AS totalAmount FROM contract_payment WHERE contract_id = ?1",nativeQuery = true)
    BigDecimal countTotalAmountByContractId(Long contractId);
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/repository/ContractRepository.java
New file
@@ -0,0 +1,121 @@
/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.modules.contract.repository;
import me.zhengjie.modules.contract.domain.Contract;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import java.math.BigDecimal;
import java.util.List;
/**
* @website https://eladmin.vip
* @author 赵士淞
* @date 2023-02-02
**/
public interface ContractRepository extends JpaRepository<Contract, Long>, JpaSpecificationExecutor<Contract> {
    /**
     * 查询当天合同数据
     * @return
     */
    @Query(value = "SELECT * FROM contract WHERE contract_number LIKE concat(?1,'%')",nativeQuery = true)
    List<Contract> findLikeContractNumber(String contractNumber);
    /**
     * 查询合同款总金额
     * @return
     */
    @Query(value = "SELECT SUM(contract_amount) FROM contract WHERE " +
            "CASE WHEN ?1 IS NOT NULL THEN contract_number = ?1 ELSE 1 = 1 END AND " +
            "CASE WHEN ?2 IS NOT NULL THEN contract_name LIKE concat('%',?2,'%') ELSE 1 = 1 END AND " +
            "CASE WHEN ?3 IS NOT NULL THEN first_id = ?3 ELSE 1 = 1 END AND " +
            "CASE WHEN ?4 IS NOT NULL THEN second_id = ?4 ELSE 1 = 1 END AND " +
            "CASE WHEN ?5 IS NOT NULL THEN sign_date BETWEEN ?5 AND ?6 ELSE 1 = 1 END AND " +
            "CASE WHEN ?7 IS NOT NULL THEN contract_type = ?7 ELSE 1 = 1 END AND " +
            "CASE WHEN ?8 IS NOT NULL THEN contract_payment_state = ?8 ELSE 1 = 1 END AND " +
            "CASE WHEN ?9 IS NOT NULL THEN service_payment_state = ?9 ELSE 1 = 1 END AND " +
            "CASE WHEN ?10 IS NOT NULL THEN contract_status = ?10 ELSE 1 = 1 END AND " +
            "CASE WHEN ?11 IS NOT NULL THEN contract_area_code LIKE concat(?11,'%') ELSE 1 = 1 END",nativeQuery = true)
    BigDecimal contractTotalMoney(
            String contractNumber, String contractName, Long firstId, Long secondId, String signStartDate, String signEndDate, String contractType, String contractPaymentState,
            String servicePaymentState, String contractStatus, String contractAreaCode
    );
    /**
     * 查询有合同款的合同数据
     * @return
     */
    @Query(value = "SELECT * FROM contract WHERE " +
            "CASE WHEN ?1 IS NOT NULL THEN contract_number = ?1 ELSE 1 = 1 END AND " +
            "CASE WHEN ?2 IS NOT NULL THEN contract_name LIKE concat('%',?2,'%') ELSE 1 = 1 END AND " +
            "CASE WHEN ?3 IS NOT NULL THEN first_id = ?3 ELSE 1 = 1 END AND " +
            "CASE WHEN ?4 IS NOT NULL THEN second_id = ?4 ELSE 1 = 1 END AND " +
            "CASE WHEN ?5 IS NOT NULL THEN sign_date BETWEEN ?5 AND ?6 ELSE 1 = 1 END AND " +
            "CASE WHEN ?7 IS NOT NULL THEN contract_type = ?7 ELSE 1 = 1 END AND " +
            "CASE WHEN ?8 IS NOT NULL THEN contract_payment_state = ?8 ELSE 1 = 1 END AND " +
            "CASE WHEN ?9 IS NOT NULL THEN service_payment_state = ?9 ELSE 1 = 1 END AND " +
            "CASE WHEN ?10 IS NOT NULL THEN contract_status = ?10 ELSE 1 = 1 END AND " +
            "CASE WHEN ?11 IS NOT NULL THEN contract_area_code LIKE concat(?11,'%') ELSE 1 = 1 END AND " +
            "contract_amount IS NOT NULL AND contract_amount != ''",nativeQuery = true)
    List<Contract> findContractAmountNotNull(
            String contractNumber, String contractName, Long firstId, Long secondId, String signStartDate, String signEndDate, String contractType, String contractPaymentState,
            String servicePaymentState, String contractStatus, String contractAreaCode
    );
    /**
     * 查询运维服务总金额
     * @return
     */
    @Query(value = "SELECT SUM(service_amount) FROM contract WHERE " +
            "CASE WHEN ?1 IS NOT NULL THEN contract_number = ?1 ELSE 1 = 1 END AND " +
            "CASE WHEN ?2 IS NOT NULL THEN contract_name LIKE concat('%',?2,'%') ELSE 1 = 1 END AND " +
            "CASE WHEN ?3 IS NOT NULL THEN first_id = ?3 ELSE 1 = 1 END AND " +
            "CASE WHEN ?4 IS NOT NULL THEN second_id = ?4 ELSE 1 = 1 END AND " +
            "CASE WHEN ?5 IS NOT NULL THEN sign_date BETWEEN ?5 AND ?6 ELSE 1 = 1 END AND " +
            "CASE WHEN ?7 IS NOT NULL THEN contract_type = ?7 ELSE 1 = 1 END AND " +
            "CASE WHEN ?8 IS NOT NULL THEN contract_payment_state = ?8 ELSE 1 = 1 END AND " +
            "CASE WHEN ?9 IS NOT NULL THEN service_payment_state = ?9 ELSE 1 = 1 END AND " +
            "CASE WHEN ?10 IS NOT NULL THEN contract_status = ?10 ELSE 1 = 1 END AND " +
            "CASE WHEN ?11 IS NOT NULL THEN contract_area_code LIKE concat(?11,'%') ELSE 1 = 1 END",nativeQuery = true)
    BigDecimal serviceTotalMoney(
            String contractNumber, String contractName, Long firstId, Long secondId, String signStartDate, String signEndDate, String contractType, String contractPaymentState,
            String servicePaymentState, String contractStatus, String contractAreaCode
    );
    /**
     * 查询有运维服务的合同数据
     * @return
     */
    @Query(value = "SELECT * FROM contract WHERE " +
            "CASE WHEN ?1 IS NOT NULL THEN contract_number = ?1 ELSE 1 = 1 END AND " +
            "CASE WHEN ?2 IS NOT NULL THEN contract_name LIKE concat('%',?2,'%') ELSE 1 = 1 END AND " +
            "CASE WHEN ?3 IS NOT NULL THEN first_id = ?3 ELSE 1 = 1 END AND " +
            "CASE WHEN ?4 IS NOT NULL THEN second_id = ?4 ELSE 1 = 1 END AND " +
            "CASE WHEN ?5 IS NOT NULL THEN sign_date BETWEEN ?5 AND ?6 ELSE 1 = 1 END AND " +
            "CASE WHEN ?7 IS NOT NULL THEN contract_type = ?7 ELSE 1 = 1 END AND " +
            "CASE WHEN ?8 IS NOT NULL THEN contract_payment_state = ?8 ELSE 1 = 1 END AND " +
            "CASE WHEN ?9 IS NOT NULL THEN service_payment_state = ?9 ELSE 1 = 1 END AND " +
            "CASE WHEN ?10 IS NOT NULL THEN contract_status = ?10 ELSE 1 = 1 END AND " +
            "CASE WHEN ?11 IS NOT NULL THEN contract_area_code LIKE concat(?11,'%') ELSE 1 = 1 END AND " +
            "service_amount IS NOT NULL AND service_amount != ''",nativeQuery = true)
    List<Contract> findServiceAmountNotNull(
            String contractNumber, String contractName, Long firstId, Long secondId, String signStartDate, String signEndDate, String contractType, String contractPaymentState,
            String servicePaymentState, String contractStatus, String contractAreaCode
    );
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/repository/ContractSecondRepository.java
New file
@@ -0,0 +1,28 @@
/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.modules.contract.repository;
import me.zhengjie.modules.contract.domain.ContractSecond;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
/**
* @website https://eladmin.vip
* @author 赵士淞
* @date 2023-02-02
**/
public interface ContractSecondRepository extends JpaRepository<ContractSecond, Long>, JpaSpecificationExecutor<ContractSecond> {
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/rest/ContractController.java
New file
@@ -0,0 +1,159 @@
/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.modules.contract.rest;
import me.zhengjie.annotation.Log;
import me.zhengjie.modules.contract.domain.Contract;
import me.zhengjie.modules.contract.service.ContractService;
import me.zhengjie.modules.contract.service.dto.ContractQueryCriteria;
import org.springframework.data.domain.Pageable;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.*;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
/**
* @website https://eladmin.vip
* @author 赵士淞
* @date 2023-02-02
**/
@RestController
@RequiredArgsConstructor
@Api(tags = "合同详情管理")
@RequestMapping("/api/contract")
public class ContractController {
    private final ContractService contractService;
    @Log("导出数据")
    @ApiOperation("导出数据")
    @GetMapping(value = "/download")
    @PreAuthorize("@el.check('contract:download')")
    public void exportContract(HttpServletResponse response, ContractQueryCriteria criteria) throws IOException {
        contractService.download(contractService.queryAll(criteria), response);
    }
    @GetMapping
    @Log("查询合同详情")
    @ApiOperation("查询合同详情")
    @PreAuthorize("@el.check('contract:list')")
    public ResponseEntity<Object> queryContract(ContractQueryCriteria criteria, Pageable pageable){
        return new ResponseEntity<>(contractService.queryAll(criteria,pageable),HttpStatus.OK);
    }
    @GetMapping(value = "/all")
    @Log("查询合同详情")
    @ApiOperation("查询合同详情")
    @PreAuthorize("@el.check('contract:list')")
    public ResponseEntity<Object> queryContract(ContractQueryCriteria criteria){
        return new ResponseEntity<>(contractService.queryAll(criteria),HttpStatus.OK);
    }
    @PostMapping
    @Log("新增合同详情")
    @ApiOperation("新增合同详情")
    @PreAuthorize("@el.check('contract:add')")
    public ResponseEntity<Object> createContract(@Validated @RequestBody Contract resources){
        return new ResponseEntity<>(contractService.create(resources),HttpStatus.CREATED);
    }
    @PutMapping
    @Log("修改合同详情")
    @ApiOperation("修改合同详情")
    @PreAuthorize("@el.check('contract:edit')")
    public ResponseEntity<Object> updateContract(@Validated @RequestBody Contract resources){
        contractService.update(resources);
        return new ResponseEntity<>(HttpStatus.NO_CONTENT);
    }
    @DeleteMapping
    @Log("删除合同详情")
    @ApiOperation("删除合同详情")
    @PreAuthorize("@el.check('contract:del')")
    public ResponseEntity<Object> deleteContract(@RequestBody Long[] ids) {
        contractService.deleteAll(ids);
        return new ResponseEntity<>(HttpStatus.OK);
    }
    @GetMapping(value = "/contractTotalMoney")
    @Log("查询合同款总金额")
    @ApiOperation("查询合同款总金额")
    @PreAuthorize("@el.check('contract:list')")
    public ResponseEntity<Object> contractTotalMoney(ContractQueryCriteria criteria){
        return new ResponseEntity<>(contractService.contractTotalMoney(criteria),HttpStatus.OK);
    }
    @GetMapping(value = "/contractDelayTotalAmount")
    @Log("查询合同款延期数")
    @ApiOperation("查询合同款延期数")
    @PreAuthorize("@el.check('contract:list')")
    public ResponseEntity<Object> contractDelayTotalAmount(ContractQueryCriteria criteria){
        return new ResponseEntity<>(contractService.contractDelayTotalAmount(criteria),HttpStatus.OK);
    }
    @GetMapping(value = "/contractDelayTotalMoney")
    @Log("查询合同款延期金额")
    @ApiOperation("查询合同款延期金额")
    @PreAuthorize("@el.check('contract:list')")
    public ResponseEntity<Object> contractDelayTotalMoney(ContractQueryCriteria criteria){
        return new ResponseEntity<>(contractService.contractDelayTotalMoney(criteria),HttpStatus.OK);
    }
    @GetMapping(value = "/advancePaymentTotalMoney")
    @Log("查询预收款总金额")
    @ApiOperation("查询预收款总金额")
    @PreAuthorize("@el.check('contract:list')")
    public ResponseEntity<Object> advancePaymentTotalMoney(ContractQueryCriteria criteria){
        return new ResponseEntity<>(contractService.advancePaymentTotalMoney(criteria),HttpStatus.OK);
    }
    @GetMapping(value = "/serviceTotalMoney")
    @Log("查询运维服务总金额")
    @ApiOperation("查询运维服务总金额")
    @PreAuthorize("@el.check('contract:list')")
    public ResponseEntity<Object> serviceTotalMoney(ContractQueryCriteria criteria){
        return new ResponseEntity<>(contractService.serviceTotalMoney(criteria),HttpStatus.OK);
    }
    @GetMapping(value = "/serviceDelayTotalAmount")
    @Log("查询运维服务延期数")
    @ApiOperation("查询运维服务延期数")
    @PreAuthorize("@el.check('contract:list')")
    public ResponseEntity<Object> serviceDelayTotalAmount(ContractQueryCriteria criteria){
        return new ResponseEntity<>(contractService.serviceDelayTotalAmount(criteria),HttpStatus.OK);
    }
    @GetMapping(value = "/serviceDelayTotalMoney")
    @Log("查询运维服务延期金额")
    @ApiOperation("查询运维服务延期金额")
    @PreAuthorize("@el.check('contract:list')")
    public ResponseEntity<Object> serviceDelayTotalMoney(ContractQueryCriteria criteria){
        return new ResponseEntity<>(contractService.serviceDelayTotalMoney(criteria),HttpStatus.OK);
    }
    @GetMapping(value = "/receivePaymentTotalMoney")
    @Log("查询应收款总金额")
    @ApiOperation("查询应收款总金额")
    @PreAuthorize("@el.check('contract:list')")
    public ResponseEntity<Object> receivePaymentTotalMoney(ContractQueryCriteria criteria){
        return new ResponseEntity<>(contractService.receivePaymentTotalMoney(criteria),HttpStatus.OK);
    }
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/rest/ContractFirstController.java
New file
@@ -0,0 +1,95 @@
/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.modules.contract.rest;
import me.zhengjie.annotation.Log;
import me.zhengjie.modules.contract.domain.ContractFirst;
import me.zhengjie.modules.contract.service.ContractFirstService;
import me.zhengjie.modules.contract.service.dto.ContractFirstQueryCriteria;
import org.springframework.data.domain.Pageable;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.*;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
/**
* @website https://eladmin.vip
* @author 赵士淞
* @date 2023-02-02
**/
@RestController
@RequiredArgsConstructor
@Api(tags = "合同甲方管理")
@RequestMapping("/api/contractFirst")
public class ContractFirstController {
    private final ContractFirstService contractFirstService;
    @Log("导出数据")
    @ApiOperation("导出数据")
    @GetMapping(value = "/download")
    @PreAuthorize("@el.check('contractFirst:download')")
    public void exportContractFirst(HttpServletResponse response, ContractFirstQueryCriteria criteria) throws IOException {
        contractFirstService.download(contractFirstService.queryAll(criteria), response);
    }
    @GetMapping
    @Log("查询合同甲方")
    @ApiOperation("查询合同甲方")
    @PreAuthorize("@el.check('contractFirst:list')")
    public ResponseEntity<Object> queryContractFirst(ContractFirstQueryCriteria criteria, Pageable pageable){
        return new ResponseEntity<>(contractFirstService.queryAll(criteria,pageable),HttpStatus.OK);
    }
    @GetMapping(value = "/all")
    @Log("查询合同甲方")
    @ApiOperation("查询合同甲方")
    @PreAuthorize("@el.check('contractFirst:list')")
    public ResponseEntity<Object> queryContractFirst(ContractFirstQueryCriteria criteria){
        return new ResponseEntity<>(contractFirstService.queryAll(criteria),HttpStatus.OK);
    }
    @PostMapping
    @Log("新增合同甲方")
    @ApiOperation("新增合同甲方")
    @PreAuthorize("@el.check('contractFirst:add')")
    public ResponseEntity<Object> createContractFirst(@Validated @RequestBody ContractFirst resources){
        return new ResponseEntity<>(contractFirstService.create(resources),HttpStatus.CREATED);
    }
    @PutMapping
    @Log("修改合同甲方")
    @ApiOperation("修改合同甲方")
    @PreAuthorize("@el.check('contractFirst:edit')")
    public ResponseEntity<Object> updateContractFirst(@Validated @RequestBody ContractFirst resources){
        contractFirstService.update(resources);
        return new ResponseEntity<>(HttpStatus.NO_CONTENT);
    }
    @DeleteMapping
    @Log("删除合同甲方")
    @ApiOperation("删除合同甲方")
    @PreAuthorize("@el.check('contractFirst:del')")
    public ResponseEntity<Object> deleteContractFirst(@RequestBody Long[] ids) {
        contractFirstService.deleteAll(ids);
        return new ResponseEntity<>(HttpStatus.OK);
    }
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/rest/ContractInvoiceController.java
New file
@@ -0,0 +1,96 @@
/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.modules.contract.rest;
import me.zhengjie.annotation.Log;
import me.zhengjie.modules.contract.domain.ContractInvoice;
import me.zhengjie.modules.contract.service.ContractInvoiceService;
import me.zhengjie.modules.contract.service.dto.ContractInvoiceDto;
import me.zhengjie.modules.contract.service.dto.ContractInvoiceQueryCriteria;
import org.springframework.data.domain.Pageable;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.*;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
/**
* @website https://eladmin.vip
* @author 赵士淞
* @date 2023-02-02
**/
@RestController
@RequiredArgsConstructor
@Api(tags = "合同发票管理")
@RequestMapping("/api/contractInvoice")
public class ContractInvoiceController {
    private final ContractInvoiceService contractInvoiceService;
    @Log("导出数据")
    @ApiOperation("导出数据")
    @GetMapping(value = "/download")
    @PreAuthorize("@el.check('contractInvoice:download')")
    public void exportContractInvoice(HttpServletResponse response, ContractInvoiceQueryCriteria criteria) throws IOException {
        contractInvoiceService.download(contractInvoiceService.queryAll(criteria), response);
    }
    @GetMapping
    @Log("查询合同发票")
    @ApiOperation("查询合同发票")
    @PreAuthorize("@el.check('contractInvoice:list')")
    public ResponseEntity<Object> queryContractInvoice(ContractInvoiceQueryCriteria criteria, Pageable pageable){
        return new ResponseEntity<>(contractInvoiceService.queryAll(criteria,pageable),HttpStatus.OK);
    }
    @GetMapping(value = "/all")
    @Log("查询合同发票")
    @ApiOperation("查询合同发票")
    @PreAuthorize("@el.check('contractInvoice:list')")
    public ResponseEntity<Object> queryContractInvoice(ContractInvoiceQueryCriteria criteria){
        return new ResponseEntity<>(contractInvoiceService.queryAll(criteria),HttpStatus.OK);
    }
    @PostMapping
    @Log("新增合同发票")
    @ApiOperation("新增合同发票")
    @PreAuthorize("@el.check('contractInvoice:add')")
    public ResponseEntity<Object> createContractInvoice(@Validated @RequestBody ContractInvoiceDto resources){
        return new ResponseEntity<>(contractInvoiceService.create(resources),HttpStatus.CREATED);
    }
    @PutMapping
    @Log("修改合同发票")
    @ApiOperation("修改合同发票")
    @PreAuthorize("@el.check('contractInvoice:edit')")
    public ResponseEntity<Object> updateContractInvoice(@Validated @RequestBody ContractInvoiceDto resources){
        contractInvoiceService.update(resources);
        return new ResponseEntity<>(HttpStatus.NO_CONTENT);
    }
    @DeleteMapping
    @Log("删除合同发票")
    @ApiOperation("删除合同发票")
    @PreAuthorize("@el.check('contractInvoice:del')")
    public ResponseEntity<Object> deleteContractInvoice(@RequestBody Long[] ids) {
        contractInvoiceService.deleteAll(ids);
        return new ResponseEntity<>(HttpStatus.OK);
    }
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/rest/ContractInvoicePaymentController.java
New file
@@ -0,0 +1,95 @@
/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.modules.contract.rest;
import me.zhengjie.annotation.Log;
import me.zhengjie.modules.contract.domain.ContractInvoicePayment;
import me.zhengjie.modules.contract.service.ContractInvoicePaymentService;
import me.zhengjie.modules.contract.service.dto.ContractInvoicePaymentQueryCriteria;
import org.springframework.data.domain.Pageable;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.*;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
/**
* @website https://eladmin.vip
* @author 赵士淞
* @date 2023-02-02
**/
@RestController
@RequiredArgsConstructor
@Api(tags = "合同发票付款关联管理")
@RequestMapping("/api/contractInvoicePayment")
public class ContractInvoicePaymentController {
    private final ContractInvoicePaymentService contractInvoicePaymentService;
    @Log("导出数据")
    @ApiOperation("导出数据")
    @GetMapping(value = "/download")
    @PreAuthorize("@el.check('contractInvoicePayment:download')")
    public void exportContractInvoicePayment(HttpServletResponse response, ContractInvoicePaymentQueryCriteria criteria) throws IOException {
        contractInvoicePaymentService.download(contractInvoicePaymentService.queryAll(criteria), response);
    }
    @GetMapping
    @Log("查询合同发票付款关联")
    @ApiOperation("查询合同发票付款关联")
    @PreAuthorize("@el.check('contractInvoicePayment:list')")
    public ResponseEntity<Object> queryContractInvoicePayment(ContractInvoicePaymentQueryCriteria criteria, Pageable pageable){
        return new ResponseEntity<>(contractInvoicePaymentService.queryAll(criteria,pageable),HttpStatus.OK);
    }
    @GetMapping(value = "/all")
    @Log("查询合同发票付款关联")
    @ApiOperation("查询合同发票付款关联")
    @PreAuthorize("@el.check('contractInvoicePayment:list')")
    public ResponseEntity<Object> queryContractInvoicePayment(ContractInvoicePaymentQueryCriteria criteria){
        return new ResponseEntity<>(contractInvoicePaymentService.queryAll(criteria),HttpStatus.OK);
    }
    @PostMapping
    @Log("新增合同发票付款关联")
    @ApiOperation("新增合同发票付款关联")
    @PreAuthorize("@el.check('contractInvoicePayment:add')")
    public ResponseEntity<Object> createContractInvoicePayment(@Validated @RequestBody ContractInvoicePayment resources){
        return new ResponseEntity<>(contractInvoicePaymentService.create(resources),HttpStatus.CREATED);
    }
    @PutMapping
    @Log("修改合同发票付款关联")
    @ApiOperation("修改合同发票付款关联")
    @PreAuthorize("@el.check('contractInvoicePayment:edit')")
    public ResponseEntity<Object> updateContractInvoicePayment(@Validated @RequestBody ContractInvoicePayment resources){
        contractInvoicePaymentService.update(resources);
        return new ResponseEntity<>(HttpStatus.NO_CONTENT);
    }
    @DeleteMapping
    @Log("删除合同发票付款关联")
    @ApiOperation("删除合同发票付款关联")
    @PreAuthorize("@el.check('contractInvoicePayment:del')")
    public ResponseEntity<Object> deleteContractInvoicePayment(@RequestBody Long[] ids) {
        contractInvoicePaymentService.deleteAll(ids);
        return new ResponseEntity<>(HttpStatus.OK);
    }
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/rest/ContractPaymentController.java
New file
@@ -0,0 +1,96 @@
/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.modules.contract.rest;
import me.zhengjie.annotation.Log;
import me.zhengjie.modules.contract.domain.ContractPayment;
import me.zhengjie.modules.contract.service.ContractPaymentService;
import me.zhengjie.modules.contract.service.dto.ContractPaymentDto;
import me.zhengjie.modules.contract.service.dto.ContractPaymentQueryCriteria;
import org.springframework.data.domain.Pageable;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.*;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
/**
* @website https://eladmin.vip
* @author 赵士淞
* @date 2023-02-02
**/
@RestController
@RequiredArgsConstructor
@Api(tags = "合同付款管理")
@RequestMapping("/api/contractPayment")
public class ContractPaymentController {
    private final ContractPaymentService contractPaymentService;
    @Log("导出数据")
    @ApiOperation("导出数据")
    @GetMapping(value = "/download")
    @PreAuthorize("@el.check('contractPayment:download')")
    public void exportContractPayment(HttpServletResponse response, ContractPaymentQueryCriteria criteria) throws IOException {
        contractPaymentService.download(contractPaymentService.queryAll(criteria), response);
    }
    @GetMapping
    @Log("查询合同付款")
    @ApiOperation("查询合同付款")
    @PreAuthorize("@el.check('contractPayment:list')")
    public ResponseEntity<Object> queryContractPayment(ContractPaymentQueryCriteria criteria, Pageable pageable){
        return new ResponseEntity<>(contractPaymentService.queryAll(criteria,pageable),HttpStatus.OK);
    }
    @GetMapping(value = "/all")
    @Log("查询合同付款")
    @ApiOperation("查询合同付款")
    @PreAuthorize("@el.check('contractPayment:list')")
    public ResponseEntity<Object> queryContractPayment(ContractPaymentQueryCriteria criteria){
        return new ResponseEntity<>(contractPaymentService.queryAll(criteria),HttpStatus.OK);
    }
    @PostMapping
    @Log("新增合同付款")
    @ApiOperation("新增合同付款")
    @PreAuthorize("@el.check('contractPayment:add')")
    public ResponseEntity<Object> createContractPayment(@Validated @RequestBody ContractPaymentDto resources){
        return new ResponseEntity<>(contractPaymentService.create(resources),HttpStatus.CREATED);
    }
    @PutMapping
    @Log("修改合同付款")
    @ApiOperation("修改合同付款")
    @PreAuthorize("@el.check('contractPayment:edit')")
    public ResponseEntity<Object> updateContractPayment(@Validated @RequestBody ContractPaymentDto resources){
        contractPaymentService.update(resources);
        return new ResponseEntity<>(HttpStatus.NO_CONTENT);
    }
    @DeleteMapping
    @Log("删除合同付款")
    @ApiOperation("删除合同付款")
    @PreAuthorize("@el.check('contractPayment:del')")
    public ResponseEntity<Object> deleteContractPayment(@RequestBody Long[] ids) {
        contractPaymentService.deleteAll(ids);
        return new ResponseEntity<>(HttpStatus.OK);
    }
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/rest/ContractSecondController.java
New file
@@ -0,0 +1,95 @@
/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.modules.contract.rest;
import me.zhengjie.annotation.Log;
import me.zhengjie.modules.contract.domain.ContractSecond;
import me.zhengjie.modules.contract.service.ContractSecondService;
import me.zhengjie.modules.contract.service.dto.ContractSecondQueryCriteria;
import org.springframework.data.domain.Pageable;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.*;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
/**
* @website https://eladmin.vip
* @author 赵士淞
* @date 2023-02-02
**/
@RestController
@RequiredArgsConstructor
@Api(tags = "合同乙方管理")
@RequestMapping("/api/contractSecond")
public class ContractSecondController {
    private final ContractSecondService contractSecondService;
    @Log("导出数据")
    @ApiOperation("导出数据")
    @GetMapping(value = "/download")
    @PreAuthorize("@el.check('contractSecond:download')")
    public void exportContractSecond(HttpServletResponse response, ContractSecondQueryCriteria criteria) throws IOException {
        contractSecondService.download(contractSecondService.queryAll(criteria), response);
    }
    @GetMapping
    @Log("查询合同乙方")
    @ApiOperation("查询合同乙方")
    @PreAuthorize("@el.check('contractSecond:list')")
    public ResponseEntity<Object> queryContractSecond(ContractSecondQueryCriteria criteria, Pageable pageable){
        return new ResponseEntity<>(contractSecondService.queryAll(criteria,pageable),HttpStatus.OK);
    }
    @GetMapping(value = "/all")
    @Log("查询合同乙方")
    @ApiOperation("查询合同乙方")
    @PreAuthorize("@el.check('contractSecond:list')")
    public ResponseEntity<Object> queryContractSecond(ContractSecondQueryCriteria criteria){
        return new ResponseEntity<>(contractSecondService.queryAll(criteria),HttpStatus.OK);
    }
    @PostMapping
    @Log("新增合同乙方")
    @ApiOperation("新增合同乙方")
    @PreAuthorize("@el.check('contractSecond:add')")
    public ResponseEntity<Object> createContractSecond(@Validated @RequestBody ContractSecond resources){
        return new ResponseEntity<>(contractSecondService.create(resources),HttpStatus.CREATED);
    }
    @PutMapping
    @Log("修改合同乙方")
    @ApiOperation("修改合同乙方")
    @PreAuthorize("@el.check('contractSecond:edit')")
    public ResponseEntity<Object> updateContractSecond(@Validated @RequestBody ContractSecond resources){
        contractSecondService.update(resources);
        return new ResponseEntity<>(HttpStatus.NO_CONTENT);
    }
    @DeleteMapping
    @Log("删除合同乙方")
    @ApiOperation("删除合同乙方")
    @PreAuthorize("@el.check('contractSecond:del')")
    public ResponseEntity<Object> deleteContractSecond(@RequestBody Long[] ids) {
        contractSecondService.deleteAll(ids);
        return new ResponseEntity<>(HttpStatus.OK);
    }
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/service/ContractFirstService.java
New file
@@ -0,0 +1,83 @@
/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.modules.contract.service;
import me.zhengjie.modules.contract.domain.ContractFirst;
import me.zhengjie.modules.contract.service.dto.ContractFirstDto;
import me.zhengjie.modules.contract.service.dto.ContractFirstQueryCriteria;
import org.springframework.data.domain.Pageable;
import java.util.Map;
import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
/**
* @website https://eladmin.vip
* @description 服务接口
* @author 赵士淞
* @date 2023-02-02
**/
public interface ContractFirstService {
    /**
    * 查询数据分页
    * @param criteria 条件
    * @param pageable 分页参数
    * @return Map<String,Object>
    */
    Map<String,Object> queryAll(ContractFirstQueryCriteria criteria, Pageable pageable);
    /**
    * 查询所有数据不分页
    * @param criteria 条件参数
    * @return List<ContractFirstDto>
    */
    List<ContractFirstDto> queryAll(ContractFirstQueryCriteria criteria);
    /**
     * 根据ID查询
     * @param firstId ID
     * @return ContractFirstDto
     */
    ContractFirstDto findById(Long firstId);
    /**
    * 创建
    * @param resources /
    * @return ContractFirstDto
    */
    ContractFirstDto create(ContractFirst resources);
    /**
    * 编辑
    * @param resources /
    */
    void update(ContractFirst resources);
    /**
    * 多选删除
    * @param ids /
    */
    void deleteAll(Long[] ids);
    /**
    * 导出数据
    * @param all 待导出的数据
    * @param response /
    * @throws IOException /
    */
    void download(List<ContractFirstDto> all, HttpServletResponse response) throws IOException;
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/service/ContractInvoicePaymentService.java
New file
@@ -0,0 +1,83 @@
/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.modules.contract.service;
import me.zhengjie.modules.contract.domain.ContractInvoicePayment;
import me.zhengjie.modules.contract.service.dto.ContractInvoicePaymentDto;
import me.zhengjie.modules.contract.service.dto.ContractInvoicePaymentQueryCriteria;
import org.springframework.data.domain.Pageable;
import java.util.Map;
import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
/**
* @website https://eladmin.vip
* @description 服务接口
* @author 赵士淞
* @date 2023-02-02
**/
public interface ContractInvoicePaymentService {
    /**
    * 查询数据分页
    * @param criteria 条件
    * @param pageable 分页参数
    * @return Map<String,Object>
    */
    Map<String,Object> queryAll(ContractInvoicePaymentQueryCriteria criteria, Pageable pageable);
    /**
    * 查询所有数据不分页
    * @param criteria 条件参数
    * @return List<ContractInvoicePaymentDto>
    */
    List<ContractInvoicePaymentDto> queryAll(ContractInvoicePaymentQueryCriteria criteria);
    /**
     * 根据ID查询
     * @param relationId ID
     * @return ContractInvoicePaymentDto
     */
    ContractInvoicePaymentDto findById(Long relationId);
    /**
    * 创建
    * @param resources /
    * @return ContractInvoicePaymentDto
    */
    ContractInvoicePaymentDto create(ContractInvoicePayment resources);
    /**
    * 编辑
    * @param resources /
    */
    void update(ContractInvoicePayment resources);
    /**
    * 多选删除
    * @param ids /
    */
    void deleteAll(Long[] ids);
    /**
    * 导出数据
    * @param all 待导出的数据
    * @param response /
    * @throws IOException /
    */
    void download(List<ContractInvoicePaymentDto> all, HttpServletResponse response) throws IOException;
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/service/ContractInvoiceService.java
New file
@@ -0,0 +1,83 @@
/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.modules.contract.service;
import me.zhengjie.modules.contract.domain.ContractInvoice;
import me.zhengjie.modules.contract.service.dto.ContractInvoiceDto;
import me.zhengjie.modules.contract.service.dto.ContractInvoiceQueryCriteria;
import org.springframework.data.domain.Pageable;
import java.util.Map;
import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
/**
* @website https://eladmin.vip
* @description 服务接口
* @author 赵士淞
* @date 2023-02-02
**/
public interface ContractInvoiceService {
    /**
    * 查询数据分页
    * @param criteria 条件
    * @param pageable 分页参数
    * @return Map<String,Object>
    */
    Map<String,Object> queryAll(ContractInvoiceQueryCriteria criteria, Pageable pageable);
    /**
    * 查询所有数据不分页
    * @param criteria 条件参数
    * @return List<ContractInvoiceDto>
    */
    List<ContractInvoiceDto> queryAll(ContractInvoiceQueryCriteria criteria);
    /**
     * 根据ID查询
     * @param invoiceId ID
     * @return ContractInvoiceDto
     */
    ContractInvoiceDto findById(Long invoiceId);
    /**
    * 创建
    * @param resources /
    * @return ContractInvoiceDto
    */
    ContractInvoiceDto create(ContractInvoiceDto resources);
    /**
    * 编辑
    * @param resources /
    */
    void update(ContractInvoiceDto resources);
    /**
    * 多选删除
    * @param ids /
    */
    void deleteAll(Long[] ids);
    /**
    * 导出数据
    * @param all 待导出的数据
    * @param response /
    * @throws IOException /
    */
    void download(List<ContractInvoiceDto> all, HttpServletResponse response) throws IOException;
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/service/ContractPaymentService.java
New file
@@ -0,0 +1,83 @@
/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.modules.contract.service;
import me.zhengjie.modules.contract.domain.ContractPayment;
import me.zhengjie.modules.contract.service.dto.ContractPaymentDto;
import me.zhengjie.modules.contract.service.dto.ContractPaymentQueryCriteria;
import org.springframework.data.domain.Pageable;
import java.util.Map;
import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
/**
* @website https://eladmin.vip
* @description 服务接口
* @author 赵士淞
* @date 2023-02-02
**/
public interface ContractPaymentService {
    /**
    * 查询数据分页
    * @param criteria 条件
    * @param pageable 分页参数
    * @return Map<String,Object>
    */
    Map<String,Object> queryAll(ContractPaymentQueryCriteria criteria, Pageable pageable);
    /**
    * 查询所有数据不分页
    * @param criteria 条件参数
    * @return List<ContractPaymentDto>
    */
    List<ContractPaymentDto> queryAll(ContractPaymentQueryCriteria criteria);
    /**
     * 根据ID查询
     * @param paymentId ID
     * @return ContractPaymentDto
     */
    ContractPaymentDto findById(Long paymentId);
    /**
    * 创建
    * @param resources /
    * @return ContractPaymentDto
    */
    ContractPaymentDto create(ContractPaymentDto resources);
    /**
    * 编辑
    * @param resources /
    */
    void update(ContractPaymentDto resources);
    /**
    * 多选删除
    * @param ids /
    */
    void deleteAll(Long[] ids);
    /**
    * 导出数据
    * @param all 待导出的数据
    * @param response /
    * @throws IOException /
    */
    void download(List<ContractPaymentDto> all, HttpServletResponse response) throws IOException;
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/service/ContractSecondService.java
New file
@@ -0,0 +1,83 @@
/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.modules.contract.service;
import me.zhengjie.modules.contract.domain.ContractSecond;
import me.zhengjie.modules.contract.service.dto.ContractSecondDto;
import me.zhengjie.modules.contract.service.dto.ContractSecondQueryCriteria;
import org.springframework.data.domain.Pageable;
import java.util.Map;
import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
/**
* @website https://eladmin.vip
* @description 服务接口
* @author 赵士淞
* @date 2023-02-02
**/
public interface ContractSecondService {
    /**
    * 查询数据分页
    * @param criteria 条件
    * @param pageable 分页参数
    * @return Map<String,Object>
    */
    Map<String,Object> queryAll(ContractSecondQueryCriteria criteria, Pageable pageable);
    /**
    * 查询所有数据不分页
    * @param criteria 条件参数
    * @return List<ContractSecondDto>
    */
    List<ContractSecondDto> queryAll(ContractSecondQueryCriteria criteria);
    /**
     * 根据ID查询
     * @param secondId ID
     * @return ContractSecondDto
     */
    ContractSecondDto findById(Long secondId);
    /**
    * 创建
    * @param resources /
    * @return ContractSecondDto
    */
    ContractSecondDto create(ContractSecond resources);
    /**
    * 编辑
    * @param resources /
    */
    void update(ContractSecond resources);
    /**
    * 多选删除
    * @param ids /
    */
    void deleteAll(Long[] ids);
    /**
    * 导出数据
    * @param all 待导出的数据
    * @param response /
    * @throws IOException /
    */
    void download(List<ContractSecondDto> all, HttpServletResponse response) throws IOException;
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/service/ContractService.java
New file
@@ -0,0 +1,141 @@
/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.modules.contract.service;
import me.zhengjie.modules.contract.domain.Contract;
import me.zhengjie.modules.contract.service.dto.ContractDto;
import me.zhengjie.modules.contract.service.dto.ContractQueryCriteria;
import org.springframework.data.domain.Pageable;
import java.math.BigDecimal;
import java.util.Map;
import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
/**
* @website https://eladmin.vip
* @description 服务接口
* @author 赵士淞
* @date 2023-02-02
**/
public interface ContractService {
    /**
    * 查询数据分页
    * @param criteria 条件
    * @param pageable 分页参数
    * @return Map<String,Object>
    */
    Map<String,Object> queryAll(ContractQueryCriteria criteria, Pageable pageable);
    /**
    * 查询所有数据不分页
    * @param criteria 条件参数
    * @return List<ContractDto>
    */
    List<ContractDto> queryAll(ContractQueryCriteria criteria);
    /**
     * 根据ID查询
     * @param contractId ID
     * @return ContractDto
     */
    ContractDto findById(Long contractId);
    /**
    * 创建
    * @param resources /
    * @return ContractDto
    */
    ContractDto create(Contract resources);
    /**
    * 编辑
    * @param resources /
    */
    void update(Contract resources);
    /**
    * 多选删除
    * @param ids /
    */
    void deleteAll(Long[] ids);
    /**
    * 导出数据
    * @param all 待导出的数据
    * @param response /
    * @throws IOException /
    */
    void download(List<ContractDto> all, HttpServletResponse response) throws IOException;
    /**
     * 查询合同款总金额
     * @param criteria
     * @return
     */
    BigDecimal contractTotalMoney(ContractQueryCriteria criteria);
    /**
     * 查询合同款延期数
     * @param criteria
     * @return
     */
    Integer contractDelayTotalAmount(ContractQueryCriteria criteria);
    /**
     * 查询合同款延期金额
     * @param criteria
     * @return
     */
    BigDecimal contractDelayTotalMoney(ContractQueryCriteria criteria);
    /**
     * 查询预收款总金额
     * @param criteria
     * @return
     */
    BigDecimal advancePaymentTotalMoney(ContractQueryCriteria criteria);
    /**
     * 查询运维服务总金额
     * @param criteria
     * @return
     */
    BigDecimal serviceTotalMoney(ContractQueryCriteria criteria);
    /**
     * 查询运维服务延期数
     * @param criteria
     * @return
     */
    Integer serviceDelayTotalAmount(ContractQueryCriteria criteria);
    /**
     * 查询运维服务延期金额
     * @param criteria
     * @return
     */
    BigDecimal serviceDelayTotalMoney(ContractQueryCriteria criteria);
    /**
     * 查询应收款总金额
     * @param criteria
     * @return
     */
    BigDecimal receivePaymentTotalMoney(ContractQueryCriteria criteria);
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/service/dto/ContractDto.java
New file
@@ -0,0 +1,132 @@
/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.modules.contract.service.dto;
import lombok.Data;
import me.zhengjie.base.BaseDTO;
import java.sql.Timestamp;
import java.math.BigDecimal;
import java.io.Serializable;
/**
* @website https://eladmin.vip
* @description /
* @author 赵士淞
* @date 2023-02-02
**/
@Data
public class ContractDto extends BaseDTO implements Serializable {
    /** ID */
    private Long contractId;
    /** 合同编号 */
    private String contractNumber;
    /** 合同名称 */
    private String contractName;
    /** 甲方信息ID */
    private Long firstId;
    /** 乙方信息ID */
    private Long secondId;
    /** 签订日期 */
    private Timestamp signDate;
    /** 起始日期 */
    private Timestamp startDate;
    /** 截止日期 */
    private Timestamp endDate;
    /** 合同所属地区编码 */
    private String contractAreaCode;
    /** 合同所属地区 */
    private String contractArea;
    /** 合同类型 */
    private String contractType;
    /** 合同内容 */
    private String contractContent;
    /** 合同费金额 */
    private BigDecimal contractAmount;
    /** 预计付款日期 */
    private Timestamp contractPaymentDate;
    /** 付款状态 */
    private String contractPaymentState;
    /** 服务开始日期 */
    private Timestamp serviceStartsDate;
    /** 服务费金额 */
    private BigDecimal serviceAmount;
    /** 预计付款日期 */
    private Timestamp servicePaymentDate;
    /** 付款状态 */
    private String servicePaymentState;
    /** 合同初版文件 */
    private String relatedDocumentsFirst;
    /** 合同终版文件 */
    private String relatedDocumentsFinal;
    /** 合同状态 */
    private String contractStatus;
    /** 备注信息 */
    private String remarks;
    /** 延迟情况 */
    private String contractPostponement;
    /** 延迟情况 */
    private String servicePostponement;
    /** 预收款情况 */
    private BigDecimal advancePayment;
    /** 应收款情况 */
    private BigDecimal receivePayment;
    /** 开票总金额 */
    private BigDecimal billingTotalAmount;
    /** 付款总金额 */
    private BigDecimal paymentTotalAmount;
    /** 合同款付款金额 */
    private String contractPaymentAmount;
    /** 服务款付款金额 */
    private String servicePaymentAmount;
    /** 甲方姓名 */
    private String firstName;
    /** 乙方姓名 */
    private String secondName;
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/service/dto/ContractFirstDto.java
New file
@@ -0,0 +1,62 @@
/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.modules.contract.service.dto;
import lombok.Data;
import me.zhengjie.base.BaseDTO;
import java.sql.Timestamp;
import java.io.Serializable;
/**
* @website https://eladmin.vip
* @description /
* @author 赵士淞
* @date 2023-02-02
**/
@Data
public class ContractFirstDto extends BaseDTO implements Serializable {
    /** ID */
    private Long firstId;
    /** 甲方名称 */
    private String firstName;
    /** 甲方联系人 */
    private String firstPerson;
    /** 甲方联系电话 */
    private String firstPhone;
    /** 甲方邮件 */
    private String firstEmail;
    /** 甲方传真 */
    private String firstFax;
    /** 甲方所在地区编码 */
    private String firstAreaCode;
    /** 甲方所在地区 */
    private String firstArea;
    /** 甲方详细地址 */
    private String firstAddress;
    /** 备注信息 */
    private String remarks;
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/service/dto/ContractFirstQueryCriteria.java
New file
@@ -0,0 +1,33 @@
/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.modules.contract.service.dto;
import lombok.Data;
import java.util.List;
import me.zhengjie.annotation.Query;
/**
* @website https://eladmin.vip
* @author 赵士淞
* @date 2023-02-02
**/
@Data
public class ContractFirstQueryCriteria{
    /** 模糊 */
    @Query(type = Query.Type.INNER_LIKE)
    private String firstName;
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/service/dto/ContractInvoiceDto.java
New file
@@ -0,0 +1,70 @@
/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.modules.contract.service.dto;
import lombok.Data;
import me.zhengjie.base.BaseDTO;
import java.sql.Timestamp;
import java.math.BigDecimal;
import java.io.Serializable;
import java.util.List;
/**
* @website https://eladmin.vip
* @description /
* @author 赵士淞
* @date 2023-02-02
**/
@Data
public class ContractInvoiceDto extends BaseDTO implements Serializable {
    /** ID */
    private Long invoiceId;
    /** 合同ID */
    private Long contractId;
    /** 开票时间 */
    private Timestamp billingTime;
    /** 发票类型 */
    private String invoiceType;
    /** 税前金额 */
    private BigDecimal beforeTaxAmount;
    /** 税率 */
    private Double taxRate;
    /** 税额 */
    private BigDecimal taxAmount;
    /** 税后金额 */
    private BigDecimal afterTaxAmount;
    /** 相关文件 */
    private String relatedDocuments;
    /** 备注信息 */
    private String remarks;
    /** 合同名称 */
    private String contractName;
    /** 付款信息 */
    private List<Long> contractPaymentIds;
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/service/dto/ContractInvoicePaymentDto.java
New file
@@ -0,0 +1,41 @@
/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.modules.contract.service.dto;
import lombok.Data;
import me.zhengjie.base.BaseDTO;
import java.sql.Timestamp;
import java.io.Serializable;
/**
* @website https://eladmin.vip
* @description /
* @author 赵士淞
* @date 2023-02-02
**/
@Data
public class ContractInvoicePaymentDto extends BaseDTO implements Serializable {
    /** ID */
    private Long relationId;
    /** 发票ID */
    private Long invoiceId;
    /** 付款ID */
    private Long paymentId;
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/service/dto/ContractInvoicePaymentQueryCriteria.java
New file
@@ -0,0 +1,29 @@
/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.modules.contract.service.dto;
import lombok.Data;
import java.util.List;
import me.zhengjie.annotation.Query;
/**
* @website https://eladmin.vip
* @author 赵士淞
* @date 2023-02-02
**/
@Data
public class ContractInvoicePaymentQueryCriteria{
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/service/dto/ContractInvoiceQueryCriteria.java
New file
@@ -0,0 +1,37 @@
/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.modules.contract.service.dto;
import lombok.Data;
import java.util.List;
import me.zhengjie.annotation.Query;
/**
* @website https://eladmin.vip
* @author 赵士淞
* @date 2023-02-02
**/
@Data
public class ContractInvoiceQueryCriteria{
    /** 精确 */
    @Query
    private Long contractId;
    /** 精确 */
    @Query
    private String invoiceType;
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/service/dto/ContractPaymentDto.java
New file
@@ -0,0 +1,67 @@
/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.modules.contract.service.dto;
import lombok.Data;
import me.zhengjie.base.BaseDTO;
import java.sql.Timestamp;
import java.math.BigDecimal;
import java.io.Serializable;
import java.util.List;
/**
* @website https://eladmin.vip
* @description /
* @author 赵士淞
* @date 2023-02-02
**/
@Data
public class ContractPaymentDto extends BaseDTO implements Serializable {
    /** ID */
    private Long paymentId;
    /** 合同ID */
    private Long contractId;
    /** 付款时间 */
    private Timestamp paymentTime;
    /** 款项类型 */
    private String fundType;
    /** 付款金额 */
    private BigDecimal paymentAmount;
    /** 款项内容 */
    private String fundBelong;
    /** 款项起始日期 */
    private Timestamp fundBelongStart;
    /** 款项结束日期 */
    private Timestamp fundBelongEnd;
    /** 备注信息 */
    private String remarks;
    /** 合同名称 */
    private String contractName;
    /** 发票信息 */
    private List<Long> contractInvoiceIds;
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/service/dto/ContractPaymentQueryCriteria.java
New file
@@ -0,0 +1,37 @@
/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.modules.contract.service.dto;
import lombok.Data;
import java.util.List;
import me.zhengjie.annotation.Query;
/**
* @website https://eladmin.vip
* @author 赵士淞
* @date 2023-02-02
**/
@Data
public class ContractPaymentQueryCriteria{
    /** 精确 */
    @Query
    private Long contractId;
    /** 精确 */
    @Query
    private String fundType;
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/service/dto/ContractQueryCriteria.java
New file
@@ -0,0 +1,71 @@
/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.modules.contract.service.dto;
import lombok.Data;
import java.sql.Timestamp;
import java.util.List;
import me.zhengjie.annotation.Query;
/**
* @website https://eladmin.vip
* @author 赵士淞
* @date 2023-02-02
**/
@Data
public class ContractQueryCriteria{
    /** 精确 */
    @Query
    private String contractNumber;
    /** 模糊 */
    @Query(type = Query.Type.INNER_LIKE)
    private String contractName;
    /** 精确 */
    @Query
    private Long firstId;
    /** 精确 */
    @Query
    private Long secondId;
    /** 两者之间 */
    @Query(type = Query.Type.BETWEEN)
    private List<Timestamp> signDate;
    /** 精确 */
    @Query
    private String contractType;
    /** 精确 */
    @Query
    private String contractPaymentState;
    /** 精确 */
    @Query
    private String servicePaymentState;
    /** 精确 */
    @Query
    private String contractStatus;
    /** 模糊 */
    @Query(type = Query.Type.INNER_LIKE)
    private String contractAreaCode;
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/service/dto/ContractSecondDto.java
New file
@@ -0,0 +1,62 @@
/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.modules.contract.service.dto;
import lombok.Data;
import me.zhengjie.base.BaseDTO;
import java.sql.Timestamp;
import java.io.Serializable;
/**
* @website https://eladmin.vip
* @description /
* @author 赵士淞
* @date 2023-02-02
**/
@Data
public class ContractSecondDto extends BaseDTO implements Serializable {
    /** ID */
    private Long secondId;
    /** 乙方名称 */
    private String secondName;
    /** 乙方联系人 */
    private String secondPerson;
    /** 乙方联系电话 */
    private String secondPhone;
    /** 乙方邮件 */
    private String secondEmail;
    /** 乙方传真 */
    private String secondFax;
    /** 乙方所在地区编码 */
    private String secondAreaCode;
    /** 乙方所在地区 */
    private String secondArea;
    /** 乙方详细地址 */
    private String secondAddress;
    /** 备注信息 */
    private String remarks;
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/service/dto/ContractSecondQueryCriteria.java
New file
@@ -0,0 +1,33 @@
/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.modules.contract.service.dto;
import lombok.Data;
import java.util.List;
import me.zhengjie.annotation.Query;
/**
* @website https://eladmin.vip
* @author 赵士淞
* @date 2023-02-02
**/
@Data
public class ContractSecondQueryCriteria{
    /** 模糊 */
    @Query(type = Query.Type.INNER_LIKE)
    private String secondName;
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/service/impl/ContractFirstServiceImpl.java
New file
@@ -0,0 +1,113 @@
/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.modules.contract.service.impl;
import me.zhengjie.modules.contract.domain.ContractFirst;
import me.zhengjie.utils.ValidationUtil;
import me.zhengjie.utils.FileUtil;
import lombok.RequiredArgsConstructor;
import me.zhengjie.modules.contract.repository.ContractFirstRepository;
import me.zhengjie.modules.contract.service.ContractFirstService;
import me.zhengjie.modules.contract.service.dto.ContractFirstDto;
import me.zhengjie.modules.contract.service.dto.ContractFirstQueryCriteria;
import me.zhengjie.modules.contract.service.mapstruct.ContractFirstMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import me.zhengjie.utils.PageUtil;
import me.zhengjie.utils.QueryHelp;
import java.util.List;
import java.util.Map;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.LinkedHashMap;
/**
* @website https://eladmin.vip
* @description 服务实现
* @author 赵士淞
* @date 2023-02-02
**/
@Service
@RequiredArgsConstructor
public class ContractFirstServiceImpl implements ContractFirstService {
    private final ContractFirstRepository contractFirstRepository;
    private final ContractFirstMapper contractFirstMapper;
    @Override
    public Map<String,Object> queryAll(ContractFirstQueryCriteria criteria, Pageable pageable){
        Page<ContractFirst> page = contractFirstRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
        return PageUtil.toPage(page.map(contractFirstMapper::toDto));
    }
    @Override
    public List<ContractFirstDto> queryAll(ContractFirstQueryCriteria criteria){
        return contractFirstMapper.toDto(contractFirstRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
    }
    @Override
    @Transactional
    public ContractFirstDto findById(Long firstId) {
        ContractFirst contractFirst = contractFirstRepository.findById(firstId).orElseGet(ContractFirst::new);
        ValidationUtil.isNull(contractFirst.getFirstId(),"ContractFirst","firstId",firstId);
        return contractFirstMapper.toDto(contractFirst);
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public ContractFirstDto create(ContractFirst resources) {
        return contractFirstMapper.toDto(contractFirstRepository.save(resources));
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public void update(ContractFirst resources) {
        ContractFirst contractFirst = contractFirstRepository.findById(resources.getFirstId()).orElseGet(ContractFirst::new);
        ValidationUtil.isNull( contractFirst.getFirstId(),"ContractFirst","id",resources.getFirstId());
        contractFirst.copy(resources);
        contractFirstRepository.save(contractFirst);
    }
    @Override
    public void deleteAll(Long[] ids) {
        for (Long firstId : ids) {
            contractFirstRepository.deleteById(firstId);
        }
    }
    @Override
    public void download(List<ContractFirstDto> all, HttpServletResponse response) throws IOException {
        List<Map<String, Object>> list = new ArrayList<>();
        for (ContractFirstDto contractFirst : all) {
            Map<String,Object> map = new LinkedHashMap<>();
            map.put("甲方名称", contractFirst.getFirstName());
            map.put("甲方联系人", contractFirst.getFirstPerson());
            map.put("甲方联系电话", contractFirst.getFirstPhone());
            map.put("甲方邮件", contractFirst.getFirstEmail());
            map.put("甲方传真", contractFirst.getFirstFax());
            map.put("甲方所在地区", contractFirst.getFirstArea());
            map.put("甲方详细地址", contractFirst.getFirstAddress());
            map.put("备注信息", contractFirst.getRemarks());
            map.put("创建者", contractFirst.getCreateBy());
            map.put("创建日期", contractFirst.getCreateTime());
            list.add(map);
        }
        FileUtil.downloadExcel(list, response);
    }
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/service/impl/ContractInvoicePaymentServiceImpl.java
New file
@@ -0,0 +1,147 @@
/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.modules.contract.service.impl;
import me.zhengjie.modules.contract.domain.ContractInvoicePayment;
import me.zhengjie.utils.ValidationUtil;
import me.zhengjie.utils.FileUtil;
import lombok.RequiredArgsConstructor;
import me.zhengjie.modules.contract.repository.ContractInvoicePaymentRepository;
import me.zhengjie.modules.contract.service.ContractInvoicePaymentService;
import me.zhengjie.modules.contract.service.dto.ContractInvoicePaymentDto;
import me.zhengjie.modules.contract.service.dto.ContractInvoicePaymentQueryCriteria;
import me.zhengjie.modules.contract.service.mapstruct.ContractInvoicePaymentMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import me.zhengjie.utils.PageUtil;
import me.zhengjie.utils.QueryHelp;
import java.util.List;
import java.util.Map;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.LinkedHashMap;
/**
* @website https://eladmin.vip
* @description 服务实现
* @author 赵士淞
* @date 2023-02-02
**/
@Service
@RequiredArgsConstructor
public class ContractInvoicePaymentServiceImpl implements ContractInvoicePaymentService {
    private final ContractInvoicePaymentRepository contractInvoicePaymentRepository;
    private final ContractInvoicePaymentMapper contractInvoicePaymentMapper;
    @Override
    public Map<String,Object> queryAll(ContractInvoicePaymentQueryCriteria criteria, Pageable pageable){
        Page<ContractInvoicePayment> page = contractInvoicePaymentRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
        return PageUtil.toPage(page.map(contractInvoicePaymentMapper::toDto));
    }
    @Override
    public List<ContractInvoicePaymentDto> queryAll(ContractInvoicePaymentQueryCriteria criteria){
        return contractInvoicePaymentMapper.toDto(contractInvoicePaymentRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
    }
    @Override
    @Transactional
    public ContractInvoicePaymentDto findById(Long relationId) {
        ContractInvoicePayment contractInvoicePayment = contractInvoicePaymentRepository.findById(relationId).orElseGet(ContractInvoicePayment::new);
        ValidationUtil.isNull(contractInvoicePayment.getRelationId(),"ContractInvoicePayment","relationId",relationId);
        return contractInvoicePaymentMapper.toDto(contractInvoicePayment);
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public ContractInvoicePaymentDto create(ContractInvoicePayment resources) {
        return contractInvoicePaymentMapper.toDto(contractInvoicePaymentRepository.save(resources));
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public void update(ContractInvoicePayment resources) {
        ContractInvoicePayment contractInvoicePayment = contractInvoicePaymentRepository.findById(resources.getRelationId()).orElseGet(ContractInvoicePayment::new);
        ValidationUtil.isNull( contractInvoicePayment.getRelationId(),"ContractInvoicePayment","id",resources.getRelationId());
        contractInvoicePayment.copy(resources);
        contractInvoicePaymentRepository.save(contractInvoicePayment);
    }
    @Override
    public void deleteAll(Long[] ids) {
        for (Long relationId : ids) {
            contractInvoicePaymentRepository.deleteById(relationId);
        }
    }
    @Override
    public void download(List<ContractInvoicePaymentDto> all, HttpServletResponse response) throws IOException {
        List<Map<String, Object>> list = new ArrayList<>();
        for (ContractInvoicePaymentDto contractInvoicePayment : all) {
            Map<String,Object> map = new LinkedHashMap<>();
            map.put("发票ID", contractInvoicePayment.getInvoiceId());
            map.put("付款ID", contractInvoicePayment.getPaymentId());
            map.put("创建者", contractInvoicePayment.getCreateBy());
            map.put("创建日期", contractInvoicePayment.getCreateTime());
            list.add(map);
        }
        FileUtil.downloadExcel(list, response);
    }
    /**
     * 通过付款更换相关数据
     * @param paymentId
     * @param invoiceIds
     */
    @Transactional
    public void operationMainPaymentId(Long paymentId, List<Long> invoiceIds) {
        // 删除付款相关数据
        contractInvoicePaymentRepository.deleteByPaymentId(paymentId);
        // 循环发票数组
        for(int i = 0; i < invoiceIds.size(); i ++) {
            // 实体类
            ContractInvoicePayment contractInvoicePayment = new ContractInvoicePayment();
            contractInvoicePayment.setPaymentId(paymentId);
            contractInvoicePayment.setInvoiceId(invoiceIds.get(i));
            // 保存
            contractInvoicePaymentRepository.save(contractInvoicePayment);
        }
    }
    /**
     * 通过发票更换相关数据
     * @param invoiceId
     * @param paymentIds
     */
    @Transactional
    public void operationMainInvoiceId(Long invoiceId, List<Long> paymentIds) {
        // 删除发票相关数据
        contractInvoicePaymentRepository.deleteByInvoiceId(invoiceId);
        // 循环发票数组
        for(int i = 0; i < paymentIds.size(); i ++) {
            // 实体类
            ContractInvoicePayment contractInvoicePayment = new ContractInvoicePayment();
            contractInvoicePayment.setInvoiceId(invoiceId);
            contractInvoicePayment.setPaymentId(paymentIds.get(i));
            // 保存
            contractInvoicePaymentRepository.save(contractInvoicePayment);
        }
    }
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/service/impl/ContractInvoiceServiceImpl.java
New file
@@ -0,0 +1,168 @@
/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.modules.contract.service.impl;
import me.zhengjie.modules.constant.Constant;
import me.zhengjie.modules.contract.domain.ContractInvoice;
import me.zhengjie.modules.contract.domain.ContractInvoicePayment;
import me.zhengjie.modules.contract.repository.ContractInvoicePaymentRepository;
import me.zhengjie.modules.contract.repository.ContractRepository;
import me.zhengjie.modules.contract.service.dto.ContractDto;
import me.zhengjie.modules.system.repository.DictDetailRepository;
import me.zhengjie.utils.ValidationUtil;
import me.zhengjie.utils.FileUtil;
import lombok.RequiredArgsConstructor;
import me.zhengjie.modules.contract.repository.ContractInvoiceRepository;
import me.zhengjie.modules.contract.service.ContractInvoiceService;
import me.zhengjie.modules.contract.service.dto.ContractInvoiceDto;
import me.zhengjie.modules.contract.service.dto.ContractInvoiceQueryCriteria;
import me.zhengjie.modules.contract.service.mapstruct.ContractInvoiceMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import me.zhengjie.utils.PageUtil;
import me.zhengjie.utils.QueryHelp;
import java.util.List;
import java.util.Map;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.function.Function;
/**
* @website https://eladmin.vip
* @description 服务实现
* @author 赵士淞
* @date 2023-02-02
**/
@Service
@RequiredArgsConstructor
public class ContractInvoiceServiceImpl implements ContractInvoiceService {
    private final ContractInvoiceRepository contractInvoiceRepository;
    private final ContractInvoiceMapper contractInvoiceMapper;
    private final DictDetailRepository dictDetailRepository;
    private final ContractInvoicePaymentRepository contractInvoicePaymentRepository;
    private final ContractInvoicePaymentServiceImpl contractInvoicePaymentServiceImpl;
    private final ContractServiceImpl contractServiceImpl;
    @Override
    public Map<String,Object> queryAll(ContractInvoiceQueryCriteria criteria, Pageable pageable){
        Page<ContractInvoice> page = contractInvoiceRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
        // 将实体类转换为DTO(重写)
        Function<ContractInvoice, ContractInvoiceDto> func = new Function<ContractInvoice, ContractInvoiceDto>(){
            @Override
            public ContractInvoiceDto apply(ContractInvoice t) {
                // 将实体类转换成DTO
                ContractInvoiceDto contractInvoiceDto = contractInvoiceMapper.toDto(t);
                // 查询发票相关付款数据
                List<ContractInvoicePayment> contractInvoicePayments = contractInvoicePaymentRepository.findByInvoiceId(t.getInvoiceId());
                // 相关付款列表
                List<Long> contractPaymentIds = new ArrayList<>();
                // 循环发票相关付款数据
                for(int i = 0; i < contractInvoicePayments.size(); i ++) {
                    // 相关付款列表
                    contractPaymentIds.add(contractInvoicePayments.get(i).getPaymentId());
                }
                // DTO赋值
                contractInvoiceDto.setContractPaymentIds(contractPaymentIds);
                // 查询合同数据
                ContractDto contractDto = contractServiceImpl.findById(t.getContractId());
                // DTO赋值
                contractInvoiceDto.setContractName(contractDto.getContractName());
                // 返回处理好的DTO
                return contractInvoiceDto;
            }
        };
        return PageUtil.toPage(page.map(func));
    }
    @Override
    public List<ContractInvoiceDto> queryAll(ContractInvoiceQueryCriteria criteria){
        return contractInvoiceMapper.toDto(contractInvoiceRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
    }
    @Override
    @Transactional
    public ContractInvoiceDto findById(Long invoiceId) {
        ContractInvoice contractInvoice = contractInvoiceRepository.findById(invoiceId).orElseGet(ContractInvoice::new);
        ValidationUtil.isNull(contractInvoice.getInvoiceId(),"ContractInvoice","invoiceId",invoiceId);
        return contractInvoiceMapper.toDto(contractInvoice);
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public ContractInvoiceDto create(ContractInvoiceDto resources) {
        // DTO转实体类
        ContractInvoice ciEntity = contractInvoiceMapper.toEntity(resources);
        // 保存
        ContractInvoice contractInvoice = contractInvoiceRepository.save(ciEntity);
        // 操作付款发票关联表
        contractInvoicePaymentServiceImpl.operationMainInvoiceId(contractInvoice.getInvoiceId(), resources.getContractPaymentIds());
        // 返回
        return contractInvoiceMapper.toDto(contractInvoice);
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public void update(ContractInvoiceDto resources) {
        // DTO转实体类
        ContractInvoice ciEntity = contractInvoiceMapper.toEntity(resources);
        // 查询旧数据
        ContractInvoice contractInvoice = contractInvoiceRepository.findById(ciEntity.getInvoiceId()).orElseGet(ContractInvoice::new);
        ValidationUtil.isNull( contractInvoice.getInvoiceId(),"ContractInvoice","id",ciEntity.getInvoiceId());
        // 新旧数据合并
        contractInvoice.copy(ciEntity);
        // 保存
        contractInvoiceRepository.save(contractInvoice);
        // 操作付款发票关联表
        contractInvoicePaymentServiceImpl.operationMainInvoiceId(contractInvoice.getInvoiceId(), resources.getContractPaymentIds());
    }
    @Override
    public void deleteAll(Long[] ids) {
        for (Long invoiceId : ids) {
            // 删除
            contractInvoiceRepository.deleteById(invoiceId);
            // 操作付款发票关联表
            contractInvoicePaymentServiceImpl.operationMainInvoiceId(invoiceId, new ArrayList<Long>());
        }
    }
    @Override
    public void download(List<ContractInvoiceDto> all, HttpServletResponse response) throws IOException {
        List<Map<String, Object>> list = new ArrayList<>();
        for (ContractInvoiceDto contractInvoice : all) {
            ContractDto contractDto = contractServiceImpl.findById(contractInvoice.getContractId());
            String invoiceType = contractInvoice.getInvoiceType() != null ? dictDetailRepository.findByDictNameAndValue(Constant.INVOICE_TYPE, contractInvoice.getInvoiceType()).getLabel() : "";
            Map<String,Object> map = new LinkedHashMap<>();
            map.put("所属合同", contractDto.getContractName());
            map.put("开票时间", contractInvoice.getBillingTime());
            map.put("发票类型", invoiceType);
            map.put("税前金额", contractInvoice.getBeforeTaxAmount());
            map.put("税率", contractInvoice.getTaxRate() + '%');
            map.put("税额", contractInvoice.getTaxAmount());
            map.put("税后金额", contractInvoice.getAfterTaxAmount());
            map.put("备注信息", contractInvoice.getRemarks());
            map.put("创建者", contractInvoice.getCreateBy());
            map.put("创建日期", contractInvoice.getCreateTime());
            list.add(map);
        }
        FileUtil.downloadExcel(list, response);
    }
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/service/impl/ContractPaymentServiceImpl.java
New file
@@ -0,0 +1,201 @@
/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.modules.contract.service.impl;
import me.zhengjie.modules.constant.Constant;
import me.zhengjie.modules.contract.domain.Contract;
import me.zhengjie.modules.contract.domain.ContractInvoicePayment;
import me.zhengjie.modules.contract.domain.ContractPayment;
import me.zhengjie.modules.contract.repository.ContractInvoicePaymentRepository;
import me.zhengjie.modules.contract.repository.ContractRepository;
import me.zhengjie.modules.contract.service.dto.ContractDto;
import me.zhengjie.modules.contract.service.mapstruct.ContractMapper;
import me.zhengjie.modules.system.repository.DictDetailRepository;
import me.zhengjie.utils.ValidationUtil;
import me.zhengjie.utils.FileUtil;
import lombok.RequiredArgsConstructor;
import me.zhengjie.modules.contract.repository.ContractPaymentRepository;
import me.zhengjie.modules.contract.service.ContractPaymentService;
import me.zhengjie.modules.contract.service.dto.ContractPaymentDto;
import me.zhengjie.modules.contract.service.dto.ContractPaymentQueryCriteria;
import me.zhengjie.modules.contract.service.mapstruct.ContractPaymentMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import me.zhengjie.utils.PageUtil;
import me.zhengjie.utils.QueryHelp;
import java.text.SimpleDateFormat;
import java.util.List;
import java.util.Map;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.function.Function;
/**
* @website https://eladmin.vip
* @description 服务实现
* @author 赵士淞
* @date 2023-02-02
**/
@Service
@RequiredArgsConstructor
public class ContractPaymentServiceImpl implements ContractPaymentService {
    private final ContractPaymentRepository contractPaymentRepository;
    private final ContractPaymentMapper contractPaymentMapper;
    private final DictDetailRepository dictDetailRepository;
    private final ContractInvoicePaymentRepository contractInvoicePaymentRepository;
    private final ContractInvoicePaymentServiceImpl contractInvoicePaymentServiceImpl;
    private final ContractServiceImpl contractServiceImpl;
    private final ContractMapper contractMapper;
    private final ContractRepository contractRepository;
    @Override
    public Map<String,Object> queryAll(ContractPaymentQueryCriteria criteria, Pageable pageable){
        Page<ContractPayment> page = contractPaymentRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
        // 将实体类转换为DTO(重写)
        Function<ContractPayment, ContractPaymentDto> func = new Function<ContractPayment, ContractPaymentDto>(){
            @Override
            public ContractPaymentDto apply(ContractPayment t) {
                // 将实体类转换成DTO
                ContractPaymentDto contractPaymentDto = contractPaymentMapper.toDto(t);
                // 查询付款相关发票数据
                List<ContractInvoicePayment> contractInvoicePayments = contractInvoicePaymentRepository.findByPaymentId(t.getPaymentId());
                // 相关发票列表
                List<Long> contractInvoiceIds = new ArrayList<>();
                // 循环付款相关发票数据
                for(int i = 0; i < contractInvoicePayments.size(); i ++) {
                    // 相关发票列表
                    contractInvoiceIds.add(contractInvoicePayments.get(i).getInvoiceId());
                }
                // DTO赋值
                contractPaymentDto.setContractInvoiceIds(contractInvoiceIds);
                // 查询合同数据
                ContractDto contractDto = contractServiceImpl.findById(t.getContractId());
                // DTO赋值
                contractPaymentDto.setContractName(contractDto.getContractName());
                // 返回处理好的DTO
                return contractPaymentDto;
            }
        };
        return PageUtil.toPage(page.map(func));
    }
    @Override
    public List<ContractPaymentDto> queryAll(ContractPaymentQueryCriteria criteria){
        return contractPaymentMapper.toDto(contractPaymentRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
    }
    @Override
    @Transactional
    public ContractPaymentDto findById(Long paymentId) {
        ContractPayment contractPayment = contractPaymentRepository.findById(paymentId).orElseGet(ContractPayment::new);
        ValidationUtil.isNull(contractPayment.getPaymentId(),"ContractPayment","paymentId",paymentId);
        return contractPaymentMapper.toDto(contractPayment);
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public ContractPaymentDto create(ContractPaymentDto resources) {
        // DTO转实体类
        ContractPayment cpEntity = contractPaymentMapper.toEntity(resources);
        // 保存
        ContractPayment contractPayment = contractPaymentRepository.save(cpEntity);
        // 操作付款发票关联表
        contractInvoicePaymentServiceImpl.operationMainPaymentId(contractPayment.getPaymentId(), resources.getContractInvoiceIds());
        // 查询合同数据
        ContractDto contractDto = contractServiceImpl.findById(resources.getContractId());
        // 更新合同付款状态
        Contract contract = contractServiceImpl.updatePaymentStatus(contractMapper.toEntity(contractDto));
        // 保存合同
        contractRepository.save(contract);
        // 返回
        return contractPaymentMapper.toDto(contractPayment);
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public void update(ContractPaymentDto resources) {
        // DTO转实体类
        ContractPayment cpEntity = contractPaymentMapper.toEntity(resources);
        // 查询旧数据
        ContractPayment contractPayment = contractPaymentRepository.findById(cpEntity.getPaymentId()).orElseGet(ContractPayment::new);
        ValidationUtil.isNull( contractPayment.getPaymentId(),"ContractPayment","id",cpEntity.getPaymentId());
        // 新旧数据合并
        contractPayment.copy(cpEntity);
        // 保存
        contractPaymentRepository.save(contractPayment);
        // 操作付款发票关联表
        contractInvoicePaymentServiceImpl.operationMainPaymentId(contractPayment.getPaymentId(), resources.getContractInvoiceIds());
        // 查询合同数据
        ContractDto contractDto = contractServiceImpl.findById(resources.getContractId());
        // 更新合同付款状态
        Contract contract = contractServiceImpl.updatePaymentStatus(contractMapper.toEntity(contractDto));
        // 保存合同
        contractRepository.save(contract);
    }
    @Override
    public void deleteAll(Long[] ids) {
        for (Long paymentId : ids) {
            // 查询旧数据
            ContractPayment contractPayment = contractPaymentRepository.findById(paymentId).orElseGet(ContractPayment::new);
            // 删除
            contractPaymentRepository.deleteById(paymentId);
            // 操作付款发票关联表
            contractInvoicePaymentServiceImpl.operationMainPaymentId(paymentId, new ArrayList<Long>());
            // 查询合同数据
            ContractDto contractDto = contractServiceImpl.findById(contractPayment.getContractId());
            // 更新合同付款状态
            Contract contract = contractServiceImpl.updatePaymentStatus(contractMapper.toEntity(contractDto));
            // 保存合同
            contractRepository.save(contract);
        }
    }
    @Override
    public void download(List<ContractPaymentDto> all, HttpServletResponse response) throws IOException {
        List<Map<String, Object>> list = new ArrayList<>();
        for (ContractPaymentDto contractPayment : all) {
            String fundType = contractPayment.getFundType() != null ? dictDetailRepository.findByDictNameAndValue(Constant.FUND_TYPE, contractPayment.getFundType()).getLabel() : "";
            String fundBelong = null;
            if(contractPayment.getFundBelong() != null) {
                fundBelong = contractPayment.getFundBelong();
            } else if(contractPayment.getFundBelongStart() != null && contractPayment.getFundBelongEnd() != null) {
                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                String fundBelongStart = sdf.format(contractPayment.getFundBelongStart());
                String fundBelongEnd = sdf.format(contractPayment.getFundBelongEnd());
                fundBelong = fundBelongStart.substring(0, 10) + " 至 " + fundBelongEnd.substring(0, 10) + " 服务费";
            }
            ContractDto contractDto = contractServiceImpl.findById(contractPayment.getContractId());
            Map<String,Object> map = new LinkedHashMap<>();
            map.put("所属合同", contractDto.getContractName());
            map.put("付款时间", contractPayment.getPaymentTime());
            map.put("款项类型", fundType);
            map.put("付款金额", contractPayment.getPaymentAmount());
            map.put("款项所属", fundBelong);
            map.put("备注信息", contractPayment.getRemarks());
            map.put("创建者", contractPayment.getCreateBy());
            map.put("创建日期", contractPayment.getCreateTime());
            list.add(map);
        }
        FileUtil.downloadExcel(list, response);
    }
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/service/impl/ContractSecondServiceImpl.java
New file
@@ -0,0 +1,113 @@
/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.modules.contract.service.impl;
import me.zhengjie.modules.contract.domain.ContractSecond;
import me.zhengjie.utils.ValidationUtil;
import me.zhengjie.utils.FileUtil;
import lombok.RequiredArgsConstructor;
import me.zhengjie.modules.contract.repository.ContractSecondRepository;
import me.zhengjie.modules.contract.service.ContractSecondService;
import me.zhengjie.modules.contract.service.dto.ContractSecondDto;
import me.zhengjie.modules.contract.service.dto.ContractSecondQueryCriteria;
import me.zhengjie.modules.contract.service.mapstruct.ContractSecondMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import me.zhengjie.utils.PageUtil;
import me.zhengjie.utils.QueryHelp;
import java.util.List;
import java.util.Map;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.LinkedHashMap;
/**
* @website https://eladmin.vip
* @description 服务实现
* @author 赵士淞
* @date 2023-02-02
**/
@Service
@RequiredArgsConstructor
public class ContractSecondServiceImpl implements ContractSecondService {
    private final ContractSecondRepository contractSecondRepository;
    private final ContractSecondMapper contractSecondMapper;
    @Override
    public Map<String,Object> queryAll(ContractSecondQueryCriteria criteria, Pageable pageable){
        Page<ContractSecond> page = contractSecondRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
        return PageUtil.toPage(page.map(contractSecondMapper::toDto));
    }
    @Override
    public List<ContractSecondDto> queryAll(ContractSecondQueryCriteria criteria){
        return contractSecondMapper.toDto(contractSecondRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
    }
    @Override
    @Transactional
    public ContractSecondDto findById(Long secondId) {
        ContractSecond contractSecond = contractSecondRepository.findById(secondId).orElseGet(ContractSecond::new);
        ValidationUtil.isNull(contractSecond.getSecondId(),"ContractSecond","secondId",secondId);
        return contractSecondMapper.toDto(contractSecond);
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public ContractSecondDto create(ContractSecond resources) {
        return contractSecondMapper.toDto(contractSecondRepository.save(resources));
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public void update(ContractSecond resources) {
        ContractSecond contractSecond = contractSecondRepository.findById(resources.getSecondId()).orElseGet(ContractSecond::new);
        ValidationUtil.isNull( contractSecond.getSecondId(),"ContractSecond","id",resources.getSecondId());
        contractSecond.copy(resources);
        contractSecondRepository.save(contractSecond);
    }
    @Override
    public void deleteAll(Long[] ids) {
        for (Long secondId : ids) {
            contractSecondRepository.deleteById(secondId);
        }
    }
    @Override
    public void download(List<ContractSecondDto> all, HttpServletResponse response) throws IOException {
        List<Map<String, Object>> list = new ArrayList<>();
        for (ContractSecondDto contractSecond : all) {
            Map<String,Object> map = new LinkedHashMap<>();
            map.put("乙方名称", contractSecond.getSecondName());
            map.put("乙方联系人", contractSecond.getSecondPerson());
            map.put("乙方联系电话", contractSecond.getSecondPhone());
            map.put("乙方邮件", contractSecond.getSecondEmail());
            map.put("乙方传真", contractSecond.getSecondFax());
            map.put("乙方所在地区", contractSecond.getSecondArea());
            map.put("乙方详细地址", contractSecond.getSecondAddress());
            map.put("备注信息", contractSecond.getRemarks());
            map.put("创建者", contractSecond.getCreateBy());
            map.put("创建日期", contractSecond.getCreateTime());
            list.add(map);
        }
        FileUtil.downloadExcel(list, response);
    }
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/service/impl/ContractServiceImpl.java
New file
@@ -0,0 +1,973 @@
/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.modules.contract.service.impl;
import me.zhengjie.modules.constant.Constant;
import me.zhengjie.modules.contract.domain.Contract;
import me.zhengjie.modules.contract.domain.ContractInvoice;
import me.zhengjie.modules.contract.domain.ContractInvoicePayment;
import me.zhengjie.modules.contract.domain.ContractPayment;
import me.zhengjie.modules.contract.repository.ContractInvoicePaymentRepository;
import me.zhengjie.modules.contract.repository.ContractInvoiceRepository;
import me.zhengjie.modules.contract.repository.ContractPaymentRepository;
import me.zhengjie.modules.contract.service.dto.ContractFirstDto;
import me.zhengjie.modules.contract.service.dto.ContractSecondDto;
import me.zhengjie.modules.system.repository.DictDetailRepository;
import me.zhengjie.utils.ValidationUtil;
import me.zhengjie.utils.FileUtil;
import lombok.RequiredArgsConstructor;
import me.zhengjie.modules.contract.repository.ContractRepository;
import me.zhengjie.modules.contract.service.ContractService;
import me.zhengjie.modules.contract.service.dto.ContractDto;
import me.zhengjie.modules.contract.service.dto.ContractQueryCriteria;
import me.zhengjie.modules.contract.service.mapstruct.ContractMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import me.zhengjie.utils.PageUtil;
import me.zhengjie.utils.QueryHelp;
import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.temporal.ChronoUnit;
import java.util.*;
import java.io.IOException;
import java.util.function.Function;
import javax.servlet.http.HttpServletResponse;
/**
* @website https://eladmin.vip
* @description 服务实现
* @author 赵士淞
* @date 2023-02-02
**/
@Service
@RequiredArgsConstructor
public class ContractServiceImpl implements ContractService {
    private final ContractRepository contractRepository;
    private final ContractMapper contractMapper;
    private final ContractPaymentRepository contractPaymentRepository;
    private final ContractInvoicePaymentRepository contractInvoicePaymentRepository;
    private final ContractInvoiceRepository contractInvoiceRepository;
    private final DictDetailRepository dictDetailRepository;
    private final ContractFirstServiceImpl contractFirstServiceImpl;
    private final ContractSecondServiceImpl contractSecondServiceImpl;
    @Override
    public Map<String,Object> queryAll(ContractQueryCriteria criteria, Pageable pageable){
        Page<Contract> page = contractRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
        // 将实体类转换为DTO(重写)
        Function<Contract, ContractDto> func = new Function<Contract, ContractDto>(){
            @Override
            public ContractDto apply(Contract t) {
                // 将实体类转换成DTO
                ContractDto contractDto = contractMapper.toDto(t);
                // 合同款延期情况
                contractDto.setContractPostponement(contractPostponement(t));
                // 服务款延期情况
                contractDto.setServicePostponement(servicePostponement(t));
                // 预收款情况
                contractDto.setAdvancePayment(advancePayment(t));
                // 应收款情况
                contractDto.setReceivePayment(receivePayment(t));
                // 开票总金额
                contractDto.setBillingTotalAmount(contractInvoiceRepository.countTotalAmountByContractId(t.getContractId()));
                // 付款总金额
                contractDto.setPaymentTotalAmount(contractPaymentRepository.countTotalAmountByContractId(t.getContractId()));
                // 合同款付款金额
                contractDto.setContractPaymentAmount(contractPaymentAmount(t));
                // 服务款付款金额
                contractDto.setServicePaymentAmount(servicePaymentAmount(t));
                // 甲方姓名
                contractDto.setFirstName(contractFirstName(t));
                // 乙方姓名
                contractDto.setSecondName(contractSecondName(t));
                // 返回处理好的DTO
                return contractDto;
            }
        };
        return PageUtil.toPage(page.map(func));
    }
    @Override
    public List<ContractDto> queryAll(ContractQueryCriteria criteria){
        // 合同DTO列表
        List<ContractDto> contractDtoList = new ArrayList<>();
        // 查询合同列表
        List<Contract> contractList = contractRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder));
        // 循环合同列表
        for(int i = 0; i < contractList.size(); i ++) {
            // 实体类转DTO
            ContractDto contractDto = contractMapper.toDto(contractList.get(i));
            // 合同款延期情况
            contractDto.setContractPostponement(contractPostponement(contractList.get(i)));
            // 服务款延期情况
            contractDto.setServicePostponement(servicePostponement(contractList.get(i)));
            // 预收款情况
            contractDto.setAdvancePayment(advancePayment(contractList.get(i)));
            // 应收款情况
            contractDto.setReceivePayment(receivePayment(contractList.get(i)));
            // 开票总金额
            contractDto.setBillingTotalAmount(contractInvoiceRepository.countTotalAmountByContractId(contractList.get(i).getContractId()));
            // 付款总金额
            contractDto.setPaymentTotalAmount(contractPaymentRepository.countTotalAmountByContractId(contractList.get(i).getContractId()));
            // 甲方姓名
            contractDto.setFirstName(contractFirstName(contractList.get(i)));
            // 乙方姓名
            contractDto.setSecondName(contractSecondName(contractList.get(i)));
            // DTO新增
            contractDtoList.add(contractDto);
        }
        // 返回
        return contractDtoList;
    }
    @Override
    @Transactional
    public ContractDto findById(Long contractId) {
        Contract contract = contractRepository.findById(contractId).orElseGet(Contract::new);
        ValidationUtil.isNull(contract.getContractId(),"Contract","contractId",contractId);
        return contractMapper.toDto(contract);
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public ContractDto create(Contract resources) {
        // 当前日历类
        Calendar calendar = Calendar.getInstance();
        // 当前年份
        String year = String.valueOf(calendar.get(Calendar.YEAR));
        // 当前月份
        String month = calendar.get(Calendar.MONTH) + 1 >= 10 ? "" + (calendar.get(Calendar.MONTH) + 1) : "0" + (calendar.get(Calendar.MONTH) + 1);
        // 当前日份
        String date = calendar.get(Calendar.DATE) >= 10 ? "" + calendar.get(Calendar.DATE) : "0" + calendar.get(Calendar.DATE);
        // 查询当天合同数据
        List<Contract> contracts = contractRepository.findLikeContractNumber(year + "-" + month + date);
        // 当天合同最大编号
        int maxNumber = 0;
        // 循环当天合同数据
        for(int i = 0; i < contracts.size(); i ++) {
            // 当前合同编号
            int nowNumber = Integer.valueOf(contracts.get(i).getContractNumber().substring(10, 13));
            // 最大合同编号
            maxNumber = nowNumber > maxNumber ? nowNumber : maxNumber;
        }
        // 计算下一编号
        String nextNumber = maxNumber + 1 >= 100 ? "" + (maxNumber + 1) : maxNumber + 1 >= 10 ? "0" + (maxNumber + 1) : "00" + (maxNumber + 1);
        // 合同编号
        resources.setContractNumber(year + "-" + month + date + "-" + nextNumber);
        // 更新金额相关数据
        Contract contract = updateAmountData(resources);
        return contractMapper.toDto(contractRepository.save(contract));
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public void update(Contract resources) {
        Contract contract = contractRepository.findById(resources.getContractId()).orElseGet(Contract::new);
        ValidationUtil.isNull( contract.getContractId(),"Contract","id",resources.getContractId());
        contract.copy(resources);
        // 更新合同付款状态
        Contract contractOne = updatePaymentStatus(contract);
        // 更新金额相关数据
        Contract contractTwo = updateAmountData(contractOne);
        contractRepository.save(contractTwo);
    }
    @Override
    public void deleteAll(Long[] ids) {
        for (Long contractId : ids) {
            contractRepository.deleteById(contractId);
        }
    }
    @Override
    public void download(List<ContractDto> all, HttpServletResponse response) throws IOException {
        List<Map<String, Object>> list = new ArrayList<>();
        for (ContractDto contract : all) {
            String firstName = contractFirstName(contractMapper.toEntity(contract));
            String secondName = contractSecondName(contractMapper.toEntity(contract));
            String contractType = contract.getContractType() != null ? dictDetailRepository.findByDictNameAndValue(Constant.CONTRACT_TYPE, contract.getContractType()).getLabel() : "";
            String contractPaymentState = contract.getContractPaymentState() != null ? dictDetailRepository.findByDictNameAndValue(Constant.PAYMENT_STATE, contract.getContractPaymentState()).getLabel() : "";
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            String servicePaymentDate = null;
            if(contract.getServicePaymentDate() != null) {
                servicePaymentDate = sdf.format(contract.getServicePaymentDate());
                servicePaymentDate = servicePaymentDate.substring(5, 10);
            }
            String servicePaymentState = contract.getServicePaymentState() != null ? dictDetailRepository.findByDictNameAndValue(Constant.PAYMENT_STATE, contract.getServicePaymentState()).getLabel() : "";
            String contractStatus = contract.getContractStatus() != null ? dictDetailRepository.findByDictNameAndValue(Constant.CONTRACT_STATUS, contract.getContractStatus()).getLabel() : "";
            Map<String,Object> map = new LinkedHashMap<>();
            map.put("合同编号", contract.getContractNumber());
            map.put("合同名称", contract.getContractName());
            map.put("甲方姓名", firstName);
            map.put("乙方姓名", secondName);
            map.put("签订日期", contract.getSignDate());
            map.put("起始日期", contract.getStartDate());
            map.put("截止日期", contract.getEndDate());
            map.put("合同所属地区", contract.getContractArea());
            map.put("合同类型", contractType);
            map.put("合同内容", contract.getContractContent());
            map.put("开票总金额", contract.getBillingTotalAmount());
            map.put("付款总金额", contract.getPaymentTotalAmount());
            map.put("预收款金额", contract.getAdvancePayment());
            map.put("应收款金额", contract.getReceivePayment());
            map.put("合同费金额", contract.getContractAmount());
            map.put("合同费预计付款日期", contract.getContractPaymentDate());
            map.put("合同费付款状态", contractPaymentState);
            map.put("合同费延期情况", contract.getContractPostponement());
            map.put("服务开始日期", contract.getServiceStartsDate());
            map.put("服务费金额", contract.getServiceAmount());
            map.put("服务费预计付款日期", servicePaymentDate);
            map.put("服务费付款状态", servicePaymentState);
            map.put("服务费延期情况", contract.getServicePostponement());
            map.put("合同初版文件", contract.getRelatedDocumentsFirst());
            map.put("合同终版文件", contract.getRelatedDocumentsFinal());
            map.put("合同状态", contractStatus);
            map.put("备注信息", contract.getRemarks());
            map.put("创建者", contract.getCreateBy());
            map.put("创建日期", contract.getCreateTime());
            list.add(map);
        }
        FileUtil.downloadExcel(list, response);
    }
    /**
     * 合同甲方姓名
     * @param resources
     * @return
     */
    public String contractFirstName(Contract resources) {
        // 查询合同甲方数据
        ContractFirstDto contractFirstDto = contractFirstServiceImpl.findById(resources.getFirstId());
        return contractFirstDto.getFirstName();
    }
    /**
     * 合同乙方姓名
     * @param resources
     * @return
     */
    public String contractSecondName(Contract resources) {
        // 查询合同乙方数据
        ContractSecondDto contractSecondDto = contractSecondServiceImpl.findById(resources.getSecondId());
        return contractSecondDto.getSecondName();
    }
    /**
     * 合同款付款金额
     * @param resources
     * @return
     */
    public String contractPaymentAmount(Contract resources){
        // 查询合同各款项付款金额
        BigDecimal contractPaymentAmount = contractPaymentRepository.findByContractIdAndFundType(resources.getContractId(), Constant.FUND_CONTRACT);
        return String.valueOf(contractPaymentAmount);
    }
    /**
     * 服务款付款金额
     * @param resources
     * @return
     */
    public String servicePaymentAmount(Contract resources){
        // 时间格式化
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        // 服务开始年份
        String serviceStartsYear = null;
        // 判断服务开始日期是否为空
        if(resources.getServiceStartsDate() != null) {
            // 服务开始年份
            serviceStartsYear = resources.getServiceStartsDate().toString().substring(0, 4);
        }
        // 当前系统时间
        Date systemTime = new Date();
        // 当前系统年份
        String systemYear = sdf.format(systemTime).substring(0, 4);
        // 判断服务开始年份是否为空
        if(serviceStartsYear != null) {
            // 返回字符串
            String returnString = "";
            // 服务开始年份与当前年份差
            int years = Integer.valueOf(systemYear) - Integer.valueOf(serviceStartsYear) + 1;
            // 循环年份差
            for(int i = 0; i < years; i ++) {
                // 查询合同服务款项各年度付款金额
                BigDecimal serviceAmount = contractPaymentRepository.findByContractIdAndFundBelongStart(resources.getContractId(), Integer.valueOf(serviceStartsYear) + i);
                serviceAmount = serviceAmount == null ? new BigDecimal(0) : serviceAmount;
                // 返回字符串
                returnString += serviceAmount + "、";
            }
            return returnString;
        } else {
            return "";
        }
    }
    /**
     * 预付款情况
     * @param resources
     * @return
     */
    private BigDecimal advancePayment(Contract resources) {
        // 返回金额
        BigDecimal returnDecimal = new BigDecimal(0);
        // 查询合同付款数据
        List<ContractPayment> contractPaymentList = contractPaymentRepository.findByContractId(resources.getContractId());
        // 循环合同付款数据
        for(int i = 0; i < contractPaymentList.size(); i ++) {
            // 当前付款金额
            BigDecimal paymentAmount = contractPaymentList.get(i).getPaymentAmount();
            // 临时金额池
            BigDecimal tempDecimal = new BigDecimal(0);
            // 查询付款相关发票数据
            List<ContractInvoicePayment> contractInvoicePaymentList = contractInvoicePaymentRepository.findByPaymentId(contractPaymentList.get(i).getPaymentId());
            // 循环付款相关发票数据
            for(int j = 0; j < contractInvoicePaymentList.size(); j ++) {
                // 获取发票数据
                ContractInvoice contractInvoice = contractInvoiceRepository.findById(contractInvoicePaymentList.get(j).getInvoiceId()).orElseGet(ContractInvoice::new);
                // 临时金额池
                tempDecimal = tempDecimal.add(contractInvoice.getAfterTaxAmount());
            }
            // 临时金额
            BigDecimal temp = paymentAmount.subtract(tempDecimal);
            temp = temp.compareTo(new BigDecimal(0)) < 1 ? new BigDecimal(0) : temp;
            // 返回金额
            returnDecimal = returnDecimal.add(temp);
        }
        // 返回
        return returnDecimal;
    }
    /**
     * 应收款情况
     * @param resources
     * @return
     */
    private BigDecimal receivePayment(Contract resources) {
        // 返回金额
        BigDecimal returnDecimal = new BigDecimal(0);
        // 循环合同发票数据
        List<ContractInvoice> contractInvoiceList = contractInvoiceRepository.findByContractId(resources.getContractId());
        // 循环合同发票数据
        for(int i = 0; i < contractInvoiceList.size(); i ++) {
            // 当前发票金额
            BigDecimal paymentAmount = contractInvoiceList.get(i).getAfterTaxAmount();
            // 临时金额池
            BigDecimal tempDecimal = new BigDecimal(0);
            // 查询发票相关付款数据
            List<ContractInvoicePayment> contractInvoicePaymentList = contractInvoicePaymentRepository.findByInvoiceId(contractInvoiceList.get(i).getInvoiceId());
            // 循环发票相关付款数据
            for(int j = 0; j < contractInvoicePaymentList.size(); j ++) {
                // 获取付款数据
                ContractPayment contractPayment = contractPaymentRepository.findById(contractInvoicePaymentList.get(j).getPaymentId()).orElseGet(ContractPayment::new);
                // 临时金额池
                tempDecimal = tempDecimal.add(contractPayment.getPaymentAmount());
            }
            // 临时金额
            BigDecimal temp = paymentAmount.subtract(tempDecimal);
            temp = temp.compareTo(new BigDecimal(0)) < 1 ? new BigDecimal(0) : temp;
            // 返回金额
            returnDecimal = returnDecimal.add(temp);
        }
        // 返回
        return returnDecimal;
    }
    /**
     * 合同款延期情况
     * @param resources
     * @return
     */
    public String contractPostponement(Contract resources) {
        // 时间格式化
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        // 合同预计付款日期
        String contractPaymentDate = null;
        // 合同预计付款时间
        Date contractPaymentTime = null;
        // 判断合同预计付款日期是否为空
        if(resources.getContractPaymentDate() != null) {
            // 合同预计付款日期
            contractPaymentDate = resources.getContractPaymentDate().toString();
            // 合同预计付款时间
            try {
                contractPaymentTime = sdf.parse(contractPaymentDate.substring(0, 10) + " 00:00:00");
            } catch (ParseException e) {
                e.printStackTrace();
            }
        }
        // 当前系统时间
        Date systemTime = new Date();
        // 合同款总金额
        BigDecimal contractTotalAmount = resources.getContractAmount() == null ? new BigDecimal(0) : resources.getContractAmount();
        // 查询合同款项付款金额
        BigDecimal contractAmount = contractPaymentRepository.findByContractIdAndFundType(resources.getContractId(), Constant.FUND_CONTRACT);
        contractAmount = contractAmount == null ? new BigDecimal(0) : contractAmount;
        // 判断合同款总金额与付款金额
        if(contractTotalAmount.compareTo(contractAmount) == 1 && contractPaymentDate != null && systemTime.getTime() > contractPaymentTime.getTime()) {
            // 两时间差
            ZoneId zoneId = ZoneId.systemDefault();
            LocalDateTime fromDateTime = LocalDateTime.ofInstant(contractPaymentTime.toInstant(), zoneId);
            LocalDateTime toDateTime = LocalDateTime.ofInstant(systemTime.toInstant(), zoneId);
            LocalDateTime tempDateTime = LocalDateTime.from(fromDateTime);
            long days = tempDateTime.until(toDateTime, ChronoUnit.DAYS);
            return "延期" + days + "天";
        } else {
            return "";
        }
    }
    /**
     * 服务款延期情况
     * @param resources
     * @return
     */
    public String servicePostponement(Contract resources) {
        // 时间格式化
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        // 服务开始年份
        String serviceStartsYear = null;
        // 判断服务开始日期是否为空
        if(resources.getServiceStartsDate() != null) {
            // 服务开始年份
            serviceStartsYear = resources.getServiceStartsDate().toString().substring(0, 4);
        }
        // 服务预计付款月日
        String servicePaymentMonth = null;
        // 判断服务预计付款日期是否为空
        if(resources.getServicePaymentDate() != null) {
            // 服务预计付款月日
            servicePaymentMonth = resources.getServicePaymentDate().toString().substring(4, 10);
        }
        // 当前系统时间
        Date systemTime = new Date();
        // 当前系统年份
        String systemYear = sdf.format(systemTime).substring(0, 4);
        // 当前年付款时间
        Date systemPaymentTime = null;
        // 判断服务预计付款日期是否为空
        if(resources.getServicePaymentDate() != null) {
            // 当前年付款时间
            try {
                systemPaymentTime = sdf.parse(systemYear + servicePaymentMonth + " 00:00:00");
            } catch (ParseException e) {
                e.printStackTrace();
            }
        }
        // 服务款总金额
        BigDecimal serviceTotalAmount = resources.getServiceAmount() == null ? new BigDecimal(0) : resources.getServiceAmount();
        // 判断服务开始年份是否为空
        if(serviceStartsYear != null) {
            // 返回字符串
            String returnString = "";
            // 服务开始年份与当前年份差
            int years = Integer.valueOf(systemYear) - Integer.valueOf(serviceStartsYear) + 1;
            // 循环年份差
            for(int i = 0; i < years; i ++) {
                // 查询合同服务款项各年度付款金额
                BigDecimal serviceAmount = contractPaymentRepository.findByContractIdAndFundBelongStart(resources.getContractId(), Integer.valueOf(serviceStartsYear) + i);
                serviceAmount = serviceAmount == null ? new BigDecimal(0) : serviceAmount;
                // 判断服务款总金额与付款金额
                if(serviceTotalAmount.compareTo(serviceAmount) == 1) {
                    // 判断是否是当年数据
                    if(Integer.valueOf(serviceStartsYear) + i == Integer.valueOf(systemYear)) {
                        // 判断是否超出付款时间
                        if(systemPaymentTime != null && systemTime.getTime() > systemPaymentTime.getTime()) {
                            // 两时间差
                            ZoneId zoneId = ZoneId.systemDefault();
                            LocalDateTime fromDateTime = LocalDateTime.ofInstant(systemPaymentTime.toInstant(), zoneId);
                            LocalDateTime toDateTime = LocalDateTime.ofInstant(systemTime.toInstant(), zoneId);
                            LocalDateTime tempDateTime = LocalDateTime.from(fromDateTime);
                            long days = tempDateTime.until(toDateTime, ChronoUnit.DAYS);
                            // 返回字符串
                            returnString += "当前年度延期" + days + "天";
                        }
                    } else {
                        // 返回字符串
                        returnString += (Integer.valueOf(serviceStartsYear) + i) + "至" + (Integer.valueOf(serviceStartsYear) + (i + 1)) + "年度未结清、";
                    }
                }
            }
            return returnString;
        } else {
            return "";
        }
    }
    /**
     * 更新金额相关数据
     * @param resources
     * @return
     */
    public Contract updateAmountData(Contract resources) {
        // 判断合同类型
        if (Constant.CONTRACT_DEVELOP_SERVICE.equals(resources.getContractType())) {
            // 不处理
        } else if (Constant.CONTRACT_SERVICE.equals(resources.getContractType())) {
            // 合同费金额
            resources.setContractAmount(null);
            // 预计付款日期
            resources.setContractPaymentDate(null);
            // 付款状态
            resources.setContractPaymentState(null);
            // 服务开始日期
            resources.setServiceStartsDate(resources.getStartDate());
        } else {
            // 服务开始日期
            resources.setServiceStartsDate(null);
            // 服务费金额
            resources.setServiceAmount(null);
            // 预计付款日期
            resources.setServicePaymentDate(null);
            // 付款状态
            resources.setServicePaymentState(null);
        }
        return resources;
    }
    /**
     * 更新合同付款状态
     * @param resources
     */
    public Contract updatePaymentStatus(Contract resources) {
        // 查询数据库旧数据
        Contract contract = contractRepository.findById(resources.getContractId()).orElseGet(Contract::new);
        ValidationUtil.isNull( contract.getContractId(),"Contract","id",resources.getContractId());
        // 复制
        contract.copy(resources);
        // 时间格式化
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        // 截止日期
        String endDate = contract.getEndDate().toString();
        // 截止时间
        Date endTime = null;
        try {
            endTime = sdf.parse(endDate.substring(0, 10) + " 23:59:59");
        } catch (ParseException e) {
            e.printStackTrace();
        }
        // 服务开始日期
        String serviceStartsDate = null;
        // 服务开始时间
        Date serviceStartsTime = null;
        // 判断服务开始日期是否为空
        if(contract.getServiceStartsDate() != null) {
            // 服务开始日期
            serviceStartsDate = contract.getServiceStartsDate().toString();
            // 服务开始时间
            try {
                serviceStartsTime = sdf.parse(serviceStartsDate.substring(0, 10) + " 00:00:00");
            } catch (ParseException e) {
                e.printStackTrace();
            }
        }
        // 判断合同款项付款状态
        if(!Constant.PAYMENT_ALREADY.equals(contract.getContractPaymentState())) {
            // 合同款总金额
            BigDecimal contractTotalAmount = contract.getContractAmount() == null ? new BigDecimal(0) : contract.getContractAmount();
            // 查询合同款项付款金额
            BigDecimal contractAmount = contractPaymentRepository.findByContractIdAndFundType(contract.getContractId(), Constant.FUND_CONTRACT);
            contractAmount = contractAmount == null ? new BigDecimal(0) : contractAmount;
            // 判断合同款项付款金额
            if(Constant.CONTRACT_SERVICE.equals(contract.getContractType())) {
                // 付款状态
                contract.setContractPaymentState(null);
            } else if(contractAmount.compareTo(new BigDecimal(0)) == 0) {
                // 付款状态
                contract.setContractPaymentState(Constant.PAYMENT_NOT);
            } else if(contractAmount.compareTo(contractTotalAmount) > -1) {
                // 付款状态
                contract.setContractPaymentState(Constant.PAYMENT_ALREADY);
            } else {
                // 付款状态
                contract.setContractPaymentState(Constant.PAYMENT_PART);
            }
        }
        // 判断服务款项付款状态
        if(!Constant.PAYMENT_ALREADY.equals(contract.getServicePaymentState())) {
            // 判断服务开始日期是否为空
            if(serviceStartsTime == null) {
                // 付款状态
                contract.setServicePaymentState(null);
            } else {
                // 两时间差
                ZoneId zoneId = ZoneId.systemDefault();
                LocalDateTime fromDateTime = LocalDateTime.ofInstant(serviceStartsTime.toInstant(), zoneId);
                LocalDateTime toDateTime = LocalDateTime.ofInstant(endTime.toInstant(), zoneId);
                LocalDateTime tempDateTime = LocalDateTime.from(fromDateTime);
                long years = tempDateTime.until(toDateTime, ChronoUnit.YEARS);
                years = years == 0 ? 1 : years;
                // 服务款总金额
                BigDecimal serviceTotalAmount = contract.getServiceAmount() == null ? new BigDecimal(0) : contract.getServiceAmount();
                // 查询服务款项付款金额
                BigDecimal serviceAmount = contractPaymentRepository.findByContractIdAndFundType(contract.getContractId(), Constant.FUND_SERVICE);
                serviceAmount = serviceAmount == null ? new BigDecimal(0) : serviceAmount;
                // 判断服务款项付款金额
                if(Constant.CONTRACT_DEVELOP.equals(contract.getContractType())) {
                    // 付款状态
                    contract.setServicePaymentState(null);
                } else if(serviceAmount.compareTo(new BigDecimal(0)) == 0) {
                    // 付款状态
                    contract.setServicePaymentState(Constant.PAYMENT_NOT);
                } else if(serviceAmount.compareTo(serviceTotalAmount.multiply(new BigDecimal(years))) > -1) {
                    // 付款状态
                    contract.setServicePaymentState(Constant.PAYMENT_ALREADY);
                } else {
                    // 付款状态
                    contract.setServicePaymentState(Constant.PAYMENT_PART);
                }
            }
        }
        // 返回
        return contract;
    }
    /**
     * 查询合同款总金额
     * @param criteria
     * @return
     */
    @Override
    public BigDecimal contractTotalMoney(ContractQueryCriteria criteria){
        // 搜索数据处理
        String signStartDate = criteria.getSignDate() != null ? criteria.getSignDate().get(0).toString() : null;
        String signEndDate = criteria.getSignDate() != null ? criteria.getSignDate().get(1).toString() : null;
        // 查询合同款总金额
        BigDecimal contractTotalMoney = contractRepository.contractTotalMoney(
                criteria.getContractNumber(), criteria.getContractName(), criteria.getFirstId(), criteria.getSecondId(), signStartDate, signEndDate, criteria.getContractType(),
                criteria.getContractPaymentState(), criteria.getServicePaymentState(), criteria.getContractStatus(), criteria.getContractAreaCode()
        );
        return contractTotalMoney;
    }
    /**
     * 查询合同款延期数
     * @param criteria
     * @return
     */
    @Override
    public Integer contractDelayTotalAmount(ContractQueryCriteria criteria){
        // 合同款延期数
        Integer contractDelayTotalAmount = 0;
        // 搜索数据处理
        String signStartDate = criteria.getSignDate() != null ? criteria.getSignDate().get(0).toString() : null;
        String signEndDate = criteria.getSignDate() != null ? criteria.getSignDate().get(1).toString() : null;
        // 查询有合同款的合同数据
        List<Contract> contractList = contractRepository.findContractAmountNotNull(
                criteria.getContractNumber(), criteria.getContractName(), criteria.getFirstId(), criteria.getSecondId(), signStartDate, signEndDate, criteria.getContractType(),
                criteria.getContractPaymentState(), criteria.getServicePaymentState(), criteria.getContractStatus(), criteria.getContractAreaCode()
        );
        // 循环有合同款的合同数据
        for(int i = 0; i < contractList.size(); i ++) {
            // 查询合同各款项付款金额
            BigDecimal paymentAmount = contractPaymentRepository.findByContractIdAndFundType(contractList.get(i).getContractId(), Constant.FUND_CONTRACT);
            // 判断是否超过付款时间
            if(new Date().getTime() > contractList.get(i).getContractPaymentDate().getTime()) {
                // 判断合同各款项付款金额不为空且是否存在延期金额
                if(paymentAmount == null) {
                    // 合同款延期数
                    contractDelayTotalAmount ++;
                } else if(contractList.get(i).getContractAmount().compareTo(paymentAmount) == 1) {
                    // 合同款延期数
                    contractDelayTotalAmount ++;
                }
            }
        }
        return contractDelayTotalAmount;
    }
    /**
     * 查询合同款延期金额
     * @param criteria
     * @return
     */
    @Override
    public BigDecimal contractDelayTotalMoney(ContractQueryCriteria criteria){
        // 合同款延期金额
        BigDecimal contractDelayTotalMoney = new BigDecimal("0.00");
        // 搜索数据处理
        String signStartDate = criteria.getSignDate() != null ? criteria.getSignDate().get(0).toString() : null;
        String signEndDate = criteria.getSignDate() != null ? criteria.getSignDate().get(1).toString() : null;
        // 查询有合同款的合同数据
        List<Contract> contractList = contractRepository.findContractAmountNotNull(
                criteria.getContractNumber(), criteria.getContractName(), criteria.getFirstId(), criteria.getSecondId(), signStartDate, signEndDate, criteria.getContractType(),
                criteria.getContractPaymentState(), criteria.getServicePaymentState(), criteria.getContractStatus(), criteria.getContractAreaCode()
        );
        // 循环有合同款的合同数据
        for(int i = 0; i < contractList.size(); i ++) {
            // 查询合同各款项付款金额
            BigDecimal paymentAmount = contractPaymentRepository.findByContractIdAndFundType(contractList.get(i).getContractId(), Constant.FUND_CONTRACT);
            // 判断是否超过付款时间
            if(new Date().getTime() > contractList.get(i).getContractPaymentDate().getTime()) {
                // 判断合同各款项付款金额不为空且是否存在延期金额
                if(paymentAmount == null) {
                    // 合同款延期金额
                    contractDelayTotalMoney = contractDelayTotalMoney.add(contractList.get(i).getContractAmount());
                } else if(contractList.get(i).getContractAmount().compareTo(paymentAmount) == 1) {
                    // 延期金额
                    BigDecimal tempMoney = contractList.get(i).getContractAmount().subtract(paymentAmount);
                    // 合同款延期金额
                    contractDelayTotalMoney = contractDelayTotalMoney.add(tempMoney);
                }
            }
        }
        return contractDelayTotalMoney;
    }
    /**
     * 查询预收款总金额
     * @param criteria
     * @return
     */
    @Override
    public BigDecimal advancePaymentTotalMoney(ContractQueryCriteria criteria){
        // 预收款总金额
        BigDecimal advancePaymentTotalMoney = new BigDecimal("0.00");
        // 查询所有合同信息
        List<Contract> contractList = contractRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder));
        // 循环所有合同信息
        for(int i = 0; i < contractList.size(); i ++) {
            // 预收款总金额
            advancePaymentTotalMoney = advancePaymentTotalMoney.add(advancePayment(contractList.get(i)));
        }
        return advancePaymentTotalMoney;
    }
    /**
     * 查询运维服务总金额
     * @param criteria
     * @return
     */
    @Override
    public BigDecimal serviceTotalMoney(ContractQueryCriteria criteria){
        // 搜索数据处理
        String signStartDate = criteria.getSignDate() != null ? criteria.getSignDate().get(0).toString() : null;
        String signEndDate = criteria.getSignDate() != null ? criteria.getSignDate().get(1).toString() : null;
        // 查询运维服务总金额
        BigDecimal serviceTotalMoney = contractRepository.serviceTotalMoney(
                criteria.getContractNumber(), criteria.getContractName(), criteria.getFirstId(), criteria.getSecondId(), signStartDate, signEndDate, criteria.getContractType(),
                criteria.getContractPaymentState(), criteria.getServicePaymentState(), criteria.getContractStatus(), criteria.getContractAreaCode()
        );
        return serviceTotalMoney;
    }
    /**
     * 查询运维服务延期数
     * @param criteria
     * @return
     */
    @Override
    public Integer serviceDelayTotalAmount(ContractQueryCriteria criteria){
        // 运维服务延期数
        Integer serviceDelayTotalAmount = 0;
        // 搜索数据处理
        String signStartDate = criteria.getSignDate() != null ? criteria.getSignDate().get(0).toString() : null;
        String signEndDate = criteria.getSignDate() != null ? criteria.getSignDate().get(1).toString() : null;
        // 查询有运维服务的合同数据
        List<Contract> contractList = contractRepository.findServiceAmountNotNull(
                criteria.getContractNumber(), criteria.getContractName(), criteria.getFirstId(), criteria.getSecondId(), signStartDate, signEndDate, criteria.getContractType(),
                criteria.getContractPaymentState(), criteria.getServicePaymentState(), criteria.getContractStatus(), criteria.getContractAreaCode()
        );
        // 循环有运维服务的合同数据
        for(int i = 0; i < contractList.size(); i ++) {
            // 时间格式化
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            // 服务开始年份
            String serviceStartsYear = null;
            // 判断服务开始日期是否为空
            if(contractList.get(i).getServiceStartsDate() != null) {
                // 服务开始年份
                serviceStartsYear = contractList.get(i).getServiceStartsDate().toString().substring(0, 4);
            }
            // 服务预计付款月日
            String servicePaymentMonth = null;
            // 判断服务预计付款日期是否为空
            if(contractList.get(i).getServicePaymentDate() != null) {
                // 服务预计付款月日
                servicePaymentMonth = contractList.get(i).getServicePaymentDate().toString().substring(4, 10);
            }
            // 当前系统时间
            Date systemTime = new Date();
            // 当前系统年份
            String systemYear = sdf.format(systemTime).substring(0, 4);
            // 当前年付款时间
            Date systemPaymentTime = null;
            // 判断服务预计付款日期是否为空
            if(contractList.get(i).getServicePaymentDate() != null) {
                // 当前年付款时间
                try {
                    systemPaymentTime = sdf.parse(systemYear + servicePaymentMonth + " 00:00:00");
                } catch (ParseException e) {
                    e.printStackTrace();
                }
            }
            // 服务款总金额
            BigDecimal serviceTotalAmount = contractList.get(i).getServiceAmount() == null ? new BigDecimal(0) : contractList.get(i).getServiceAmount();
            // 判断服务开始年份是否为空
            if(serviceStartsYear != null) {
                // 服务开始年份与当前年份差
                int years = Integer.valueOf(systemYear) - Integer.valueOf(serviceStartsYear) + 1;
                // 循环年份差
                for(int j = 0; j < years; j ++) {
                    // 查询合同服务款项各年度付款金额
                    BigDecimal serviceAmount = contractPaymentRepository.findByContractIdAndFundBelongStart(contractList.get(i).getContractId(), Integer.valueOf(serviceStartsYear) + j);
                    serviceAmount = serviceAmount == null ? new BigDecimal(0) : serviceAmount;
                    // 判断服务款总金额与付款金额
                    if(serviceTotalAmount.compareTo(serviceAmount) == 1) {
                        // 判断是否是当年数据
                        if(Integer.valueOf(serviceStartsYear) + j == Integer.valueOf(systemYear)) {
                            // 判断是否超出付款时间
                            if(systemPaymentTime != null && systemTime.getTime() > systemPaymentTime.getTime()) {
                                // 运维服务延期数
                                serviceDelayTotalAmount ++;
                            }
                        } else {
                            // 运维服务延期数
                            serviceDelayTotalAmount ++;
                        }
                    }
                }
            }
        }
        return serviceDelayTotalAmount;
    }
    /**
     * 查询运维服务延期金额
     * @param criteria
     * @return
     */
    @Override
    public BigDecimal serviceDelayTotalMoney(ContractQueryCriteria criteria){
        // 运维服务延期金额
        BigDecimal serviceDelayTotalMoney = new BigDecimal("0.00");
        // 搜索数据处理
        String signStartDate = criteria.getSignDate() != null ? criteria.getSignDate().get(0).toString() : null;
        String signEndDate = criteria.getSignDate() != null ? criteria.getSignDate().get(1).toString() : null;
        // 查询有运维服务的合同数据
        List<Contract> contractList = contractRepository.findServiceAmountNotNull(
                criteria.getContractNumber(), criteria.getContractName(), criteria.getFirstId(), criteria.getSecondId(), signStartDate, signEndDate, criteria.getContractType(),
                criteria.getContractPaymentState(), criteria.getServicePaymentState(), criteria.getContractStatus(), criteria.getContractAreaCode()
        );
        // 循环有运维服务的合同数据
        for(int i = 0; i < contractList.size(); i ++) {
            // 时间格式化
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            // 服务开始年份
            String serviceStartsYear = null;
            // 判断服务开始日期是否为空
            if(contractList.get(i).getServiceStartsDate() != null) {
                // 服务开始年份
                serviceStartsYear = contractList.get(i).getServiceStartsDate().toString().substring(0, 4);
            }
            // 服务预计付款月日
            String servicePaymentMonth = null;
            // 判断服务预计付款日期是否为空
            if(contractList.get(i).getServicePaymentDate() != null) {
                // 服务预计付款月日
                servicePaymentMonth = contractList.get(i).getServicePaymentDate().toString().substring(4, 10);
            }
            // 当前系统时间
            Date systemTime = new Date();
            // 当前系统年份
            String systemYear = sdf.format(systemTime).substring(0, 4);
            // 当前年付款时间
            Date systemPaymentTime = null;
            // 判断服务预计付款日期是否为空
            if(contractList.get(i).getServicePaymentDate() != null) {
                // 当前年付款时间
                try {
                    systemPaymentTime = sdf.parse(systemYear + servicePaymentMonth + " 00:00:00");
                } catch (ParseException e) {
                    e.printStackTrace();
                }
            }
            // 服务款总金额
            BigDecimal serviceTotalAmount = contractList.get(i).getServiceAmount() == null ? new BigDecimal(0) : contractList.get(i).getServiceAmount();
            // 判断服务开始年份是否为空
            if(serviceStartsYear != null) {
                // 服务开始年份与当前年份差
                int years = Integer.valueOf(systemYear) - Integer.valueOf(serviceStartsYear) + 1;
                // 循环年份差
                for(int j = 0; j < years; j ++) {
                    // 查询合同服务款项各年度付款金额
                    BigDecimal serviceAmount = contractPaymentRepository.findByContractIdAndFundBelongStart(contractList.get(i).getContractId(), Integer.valueOf(serviceStartsYear) + j);
                    serviceAmount = serviceAmount == null ? new BigDecimal(0) : serviceAmount;
                    // 判断服务款总金额与付款金额
                    if(serviceTotalAmount.compareTo(serviceAmount) == 1) {
                        // 判断是否是当年数据
                        if(Integer.valueOf(serviceStartsYear) + j == Integer.valueOf(systemYear)) {
                            // 判断是否超出付款时间
                            if(systemPaymentTime != null && systemTime.getTime() > systemPaymentTime.getTime()) {
                                // 延期金额
                                BigDecimal tempMoney = serviceTotalAmount.subtract(serviceAmount);
                                // 运维服务延期金额
                                serviceDelayTotalMoney = serviceDelayTotalMoney.add(tempMoney);
                            }
                        } else {
                            // 延期金额
                            BigDecimal tempMoney = serviceTotalAmount.subtract(serviceAmount);
                            // 运维服务延期金额
                            serviceDelayTotalMoney = serviceDelayTotalMoney.add(tempMoney);
                        }
                    }
                }
            }
        }
        return serviceDelayTotalMoney;
    }
    /**
     * 查询应收款总金额
     * @param criteria
     * @return
     */
    @Override
    public BigDecimal receivePaymentTotalMoney(ContractQueryCriteria criteria){
        // 应收款总金额
        BigDecimal receivePaymentTotalMoney = new BigDecimal("0.00");
        // 查询所有合同信息
        List<Contract> contractList = contractRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder));
        // 循环所有合同信息
        for(int i = 0; i < contractList.size(); i ++) {
            // 应收款总金额
            receivePaymentTotalMoney = receivePaymentTotalMoney.add(receivePayment(contractList.get(i)));
        }
        return receivePaymentTotalMoney;
    }
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/service/mapstruct/ContractFirstMapper.java
New file
@@ -0,0 +1,32 @@
/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.modules.contract.service.mapstruct;
import me.zhengjie.base.BaseMapper;
import me.zhengjie.modules.contract.domain.ContractFirst;
import me.zhengjie.modules.contract.service.dto.ContractFirstDto;
import org.mapstruct.Mapper;
import org.mapstruct.ReportingPolicy;
/**
* @website https://eladmin.vip
* @author 赵士淞
* @date 2023-02-02
**/
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface ContractFirstMapper extends BaseMapper<ContractFirstDto, ContractFirst> {
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/service/mapstruct/ContractInvoiceMapper.java
New file
@@ -0,0 +1,32 @@
/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.modules.contract.service.mapstruct;
import me.zhengjie.base.BaseMapper;
import me.zhengjie.modules.contract.domain.ContractInvoice;
import me.zhengjie.modules.contract.service.dto.ContractInvoiceDto;
import org.mapstruct.Mapper;
import org.mapstruct.ReportingPolicy;
/**
* @website https://eladmin.vip
* @author 赵士淞
* @date 2023-02-02
**/
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface ContractInvoiceMapper extends BaseMapper<ContractInvoiceDto, ContractInvoice> {
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/service/mapstruct/ContractInvoicePaymentMapper.java
New file
@@ -0,0 +1,32 @@
/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.modules.contract.service.mapstruct;
import me.zhengjie.base.BaseMapper;
import me.zhengjie.modules.contract.domain.ContractInvoicePayment;
import me.zhengjie.modules.contract.service.dto.ContractInvoicePaymentDto;
import org.mapstruct.Mapper;
import org.mapstruct.ReportingPolicy;
/**
* @website https://eladmin.vip
* @author 赵士淞
* @date 2023-02-02
**/
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface ContractInvoicePaymentMapper extends BaseMapper<ContractInvoicePaymentDto, ContractInvoicePayment> {
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/service/mapstruct/ContractMapper.java
New file
@@ -0,0 +1,32 @@
/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.modules.contract.service.mapstruct;
import me.zhengjie.base.BaseMapper;
import me.zhengjie.modules.contract.domain.Contract;
import me.zhengjie.modules.contract.service.dto.ContractDto;
import org.mapstruct.Mapper;
import org.mapstruct.ReportingPolicy;
/**
* @website https://eladmin.vip
* @author 赵士淞
* @date 2023-02-02
**/
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface ContractMapper extends BaseMapper<ContractDto, Contract> {
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/service/mapstruct/ContractPaymentMapper.java
New file
@@ -0,0 +1,32 @@
/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.modules.contract.service.mapstruct;
import me.zhengjie.base.BaseMapper;
import me.zhengjie.modules.contract.domain.ContractPayment;
import me.zhengjie.modules.contract.service.dto.ContractPaymentDto;
import org.mapstruct.Mapper;
import org.mapstruct.ReportingPolicy;
/**
* @website https://eladmin.vip
* @author 赵士淞
* @date 2023-02-02
**/
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface ContractPaymentMapper extends BaseMapper<ContractPaymentDto, ContractPayment> {
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/contract/service/mapstruct/ContractSecondMapper.java
New file
@@ -0,0 +1,32 @@
/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.modules.contract.service.mapstruct;
import me.zhengjie.base.BaseMapper;
import me.zhengjie.modules.contract.domain.ContractSecond;
import me.zhengjie.modules.contract.service.dto.ContractSecondDto;
import org.mapstruct.Mapper;
import org.mapstruct.ReportingPolicy;
/**
* @website https://eladmin.vip
* @author 赵士淞
* @date 2023-02-02
**/
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface ContractSecondMapper extends BaseMapper<ContractSecondDto, ContractSecond> {
}
eladmin-master/eladmin-tools/src/main/java/me/zhengjie/rest/LocalStorageController.java
@@ -63,8 +63,8 @@
    @ApiOperation("上传文件")
    @PreAuthorize("@el.check('storage:add')")
    public ResponseEntity<Object> createFile(@RequestParam String name, @RequestParam("file") MultipartFile file){
        localStorageService.create(name, file);
        return new ResponseEntity<>(HttpStatus.CREATED);
        LocalStorage localStorage = localStorageService.create(null, file);
        return new ResponseEntity<>(localStorage, HttpStatus.CREATED);
    }
    @ApiOperation("上传图片")
eladmin-web-master/src/api/contract/contract.js
New file
@@ -0,0 +1,92 @@
import request from '@/utils/request'
import qs from 'qs'
export function getAll(params) {
  return request({
    url: 'api/contract/all',
    method: 'get',
    params
  })
}
export function add(data) {
  return request({
    url: 'api/contract',
    method: 'post',
    data
  })
}
export function del(ids) {
  return request({
    url: 'api/contract/',
    method: 'delete',
    data: ids
  })
}
export function edit(data) {
  return request({
    url: 'api/contract',
    method: 'put',
    data
  })
}
export function contractTotalMoney(params) {
  return request({
    url: 'api/contract/contractTotalMoney' + '?' + qs.stringify(params, { indices: false }),
    method: 'get'
  })
}
export function contractDelayTotalAmount(params) {
  return request({
    url: 'api/contract/contractDelayTotalAmount' + '?' + qs.stringify(params, { indices: false }),
    method: 'get'
  })
}
export function contractDelayTotalMoney(params) {
  return request({
    url: 'api/contract/contractDelayTotalMoney' + '?' + qs.stringify(params, { indices: false }),
    method: 'get'
  })
}
export function advancePaymentTotalMoney(params) {
  return request({
    url: 'api/contract/advancePaymentTotalMoney' + '?' + qs.stringify(params, { indices: false }),
    method: 'get'
  })
}
export function serviceTotalMoney(params) {
  return request({
    url: 'api/contract/serviceTotalMoney' + '?' + qs.stringify(params, { indices: false }),
    method: 'get'
  })
}
export function serviceDelayTotalAmount(params) {
  return request({
    url: 'api/contract/serviceDelayTotalAmount' + '?' + qs.stringify(params, { indices: false }),
    method: 'get'
  })
}
export function serviceDelayTotalMoney(params) {
  return request({
    url: 'api/contract/serviceDelayTotalMoney' + '?' + qs.stringify(params, { indices: false }),
    method: 'get'
  })
}
export function receivePaymentTotalMoney(params) {
  return request({
    url: 'api/contract/receivePaymentTotalMoney' + '?' + qs.stringify(params, { indices: false }),
    method: 'get'
  })
}
export default { getAll, add, edit, del }
eladmin-web-master/src/api/contract/contractFirst.js
New file
@@ -0,0 +1,35 @@
import request from '@/utils/request'
export function getAll(params) {
  return request({
    url: 'api/contractFirst/all',
    method: 'get',
    params
  })
}
export function add(data) {
  return request({
    url: 'api/contractFirst',
    method: 'post',
    data
  })
}
export function del(ids) {
  return request({
    url: 'api/contractFirst/',
    method: 'delete',
    data: ids
  })
}
export function edit(data) {
  return request({
    url: 'api/contractFirst',
    method: 'put',
    data
  })
}
export default { getAll, add, edit, del }
eladmin-web-master/src/api/contract/contractInvoice.js
New file
@@ -0,0 +1,35 @@
import request from '@/utils/request'
export function getAll(params) {
  return request({
    url: 'api/contractInvoice/all',
    method: 'get',
    params
  })
}
export function add(data) {
  return request({
    url: 'api/contractInvoice',
    method: 'post',
    data
  })
}
export function del(ids) {
  return request({
    url: 'api/contractInvoice/',
    method: 'delete',
    data: ids
  })
}
export function edit(data) {
  return request({
    url: 'api/contractInvoice',
    method: 'put',
    data
  })
}
export default { getAll, add, edit, del }
eladmin-web-master/src/api/contract/contractPayment.js
New file
@@ -0,0 +1,35 @@
import request from '@/utils/request'
export function getAll(params) {
  return request({
    url: 'api/contractPayment/all',
    method: 'get',
    params
  })
}
export function add(data) {
  return request({
    url: 'api/contractPayment',
    method: 'post',
    data
  })
}
export function del(ids) {
  return request({
    url: 'api/contractPayment/',
    method: 'delete',
    data: ids
  })
}
export function edit(data) {
  return request({
    url: 'api/contractPayment',
    method: 'put',
    data
  })
}
export default { getAll, add, edit, del }
eladmin-web-master/src/api/contract/contractSecond.js
New file
@@ -0,0 +1,35 @@
import request from '@/utils/request'
export function getAll(params) {
  return request({
    url: 'api/contractSecond/all',
    method: 'get',
    params
  })
}
export function add(data) {
  return request({
    url: 'api/contractSecond',
    method: 'post',
    data
  })
}
export function del(ids) {
  return request({
    url: 'api/contractSecond/',
    method: 'delete',
    data: ids
  })
}
export function edit(data) {
  return request({
    url: 'api/contractSecond',
    method: 'put',
    data
  })
}
export default { getAll, add, edit, del }
eladmin-web-master/src/components/Crud/crud.js
@@ -560,6 +560,20 @@
      }
    },
    /**
     * 月日格式化
     * @param {Object} timestamp 时间戳
     */
    toMonthDay(timestamp) {
      if (timestamp == null) {
        return
      } else {
        const system = new Date(timestamp)
        const month = system.getMonth() + 1 < 10 ? '0' + (system.getMonth() + 1) : system.getMonth() + 1
        const date = system.getDate() < 10 ? '0' + system.getDate() : system.getDate()
        return month + '-' + date
      }
    },
    /**
     * 时间格式化
     * @param {Object} timestamp
     */
eladmin-web-master/src/utils/constant.js
@@ -277,6 +277,29 @@
// 资产使用状态:已停止
export const ACCETS_USE_STOP = 'assets_use_stop'
// 发票类型
export const INVOICE_TYPE = 'invoice_type'
// 款项类型
export const FUND_TYPE = 'fund_type'
// 款项类型:合同费
export const FUND_CONTRACT = 'fund_contract'
// 款项类型:服务费
export const FUND_SERVICE = 'fund_service'
// 合同类型
export const CONTRACT_TYPE = 'contract_type'
// 合同类型:服务合同(年)
export const CONTRACT_SERVICE = 'contract_service'
// 合同类型:开发服务合同
export const CONTRACT_DEVELOP_SERVICE = 'contract_develop_service'
// 付款状态
export const PAYMENT_STATE = 'payment_state'
// 合同状态
export const CONTRACT_STATUS = 'contract_status'
export default {
  ROLE_LEVEL_SUPER,
  ROLE_LEVEL_GENERAL,
@@ -403,5 +426,14 @@
  ACCET_TYPE_FLOW,
  ACCETS_USE,
  ACCETS_USE_IN,
  ACCETS_USE_STOP
  ACCETS_USE_STOP,
  INVOICE_TYPE,
  FUND_TYPE,
  FUND_CONTRACT,
  FUND_SERVICE,
  CONTRACT_TYPE,
  CONTRACT_SERVICE,
  CONTRACT_DEVELOP_SERVICE,
  PAYMENT_STATE,
  CONTRACT_STATUS
}
eladmin-web-master/src/views/contract/contract/index.vue
New file
@@ -0,0 +1,890 @@
<template>
  <div class="app-container">
    <!--工具栏-->
    <div class="head-container">
      <div v-if="crud.props.searchToggle">
        <!-- 搜索 -->
        <el-input v-model="query.contractNumber" clearable placeholder="合同编号" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
        <el-input v-model="query.contractName" clearable placeholder="合同名称" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
        <el-select v-model="query.firstId" filterable clearable placeholder="所属甲方" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery">
          <el-option
            v-for="item in customerFirst"
            :key="item.firstId"
            :label="item.firstName"
            :value="item.firstId"
          >
            <span style="float: left">{{ item.firstName }}</span>
            <span style="float: right; color: #8492a6; font-size: 13px">{{ item.firstPerson }}-{{ item.firstPhone }}</span>
          </el-option>
        </el-select>
        <el-select v-model="query.secondId" filterable clearable placeholder="所属乙方" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery">
          <el-option
            v-for="item in customerSecond"
            :key="item.secondId"
            :label="item.secondName"
            :value="item.secondId"
          >
            <span style="float: left">{{ item.secondName }}</span>
            <span style="float: right; color: #8492a6; font-size: 13px">{{ item.secondPerson }}-{{ item.secondPhone }}</span>
          </el-option>
        </el-select>
        <el-select v-model="query.contractType" filterable clearable placeholder="合同类型" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery">
          <el-option
            v-for="item in dict[contractType]"
            :key="item.id"
            :label="item.label"
            :value="item.value"
          />
        </el-select>
        <el-select v-model="query.contractPaymentState" filterable clearable placeholder="合同费付款状态" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery">
          <el-option
            v-for="item in dict[paymentState]"
            :key="item.id"
            :label="item.label"
            :value="item.value"
          />
        </el-select>
        <el-select v-model="query.servicePaymentState" filterable clearable placeholder="服务费付款状态" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery">
          <el-option
            v-for="item in dict[paymentState]"
            :key="item.id"
            :label="item.label"
            :value="item.value"
          />
        </el-select>
        <el-select v-model="query.contractStatus" filterable clearable placeholder="合同状态" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery">
          <el-option
            v-for="item in dict[contractStatus]"
            :key="item.id"
            :label="item.label"
            :value="item.value"
          />
        </el-select>
        <el-select v-model="query.provincial" filterable clearable placeholder="省级" style="width: 185px;" class="filter-item" @change="queryProvincialChange" @keyup.enter.native="crud.toQuery">
          <el-option
            v-for="item in areaOptions"
            :key="item.value"
            :label="item.label"
            :value="item.value"
          />
        </el-select>
        <el-select v-model="query.city" filterable clearable placeholder="市级" style="width: 185px;" class="filter-item" @change="queryCityChange" @keyup.enter.native="crud.toQuery">
          <el-option
            v-for="item in queryCityList"
            :key="item.value"
            :label="item.label"
            :value="item.value"
          />
        </el-select>
        <el-select v-model="query.region" filterable clearable placeholder="区级" style="width: 185px;" class="filter-item" @change="queryRegionChange" @keyup.enter.native="crud.toQuery">
          <el-option
            v-for="item in queryRegionList"
            :key="item.value"
            :label="item.label"
            :value="item.value"
          />
        </el-select>
        <date-range-picker v-model="query.signDate" clearable placeholder="签订日期" style="width: 185px;" class="date-item" @keyup.enter.native="crud.toQuery" />
        <rrOperation :crud="crud" />
      </div>
      <!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
      <crudOperation :permission="permission" />
      <el-row :gutter="40" style="color: red; font-weight: bolder;">
        <el-col :xs="12" :sm="12" :lg="6">
          合同费总金额:{{ crud.toMoney(contractTotalMoney) }}
        </el-col>
        <el-col :xs="12" :sm="12" :lg="6">
          合同费延期数:{{ contractDelayTotalAmount }}
        </el-col>
        <el-col :xs="12" :sm="12" :lg="6">
          合同费延期金额:{{ crud.toMoney(contractDelayTotalMoney) }}
        </el-col>
        <el-col :xs="12" :sm="12" :lg="6">
          预收款总金额:{{ crud.toMoney(advancePaymentTotalMoney) }}
        </el-col>
      </el-row>
      <el-row :gutter="40" style="color: red; font-weight: bolder;">
        <el-col :xs="12" :sm="12" :lg="6">
          运维服务总金额:{{ crud.toMoney(serviceTotalMoney) }}
        </el-col>
        <el-col :xs="12" :sm="12" :lg="6">
          运维服务延期数:{{ serviceDelayTotalAmount }}
        </el-col>
        <el-col :xs="12" :sm="12" :lg="6">
          运维服务延期金额:{{ crud.toMoney(serviceDelayTotalMoney) }}
        </el-col>
        <el-col :xs="12" :sm="12" :lg="6">
          应收款总金额:{{ crud.toMoney(receivePaymentTotalMoney) }}
        </el-col>
      </el-row>
      <!--表单组件-->
      <el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="710px">
        <el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="120px">
          <el-form-item label="合同名称" prop="contractName">
            <el-input v-model="form.contractName" style="width: 535px;" />
          </el-form-item>
          <el-form-item label="所属甲方" prop="firstId">
            <el-select v-model="form.firstId" filterable clearable placeholder="请选择" style="width: 535px;">
              <el-option
                v-for="item in customerFirst"
                :key="item.firstId"
                :label="item.firstName"
                :value="item.firstId"
              >
                <span style="float: left">{{ item.firstName }}</span>
                <span style="float: right; color: #8492a6; font-size: 13px">{{ item.firstPerson }}-{{ item.firstPhone }}</span>
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="所属乙方" prop="secondId">
            <el-select v-model="form.secondId" filterable clearable placeholder="请选择" style="width: 535px;">
              <el-option
                v-for="item in customerSecond"
                :key="item.secondId"
                :label="item.secondName"
                :value="item.secondId"
              >
                <span style="float: left">{{ item.secondName }}</span>
                <span style="float: right; color: #8492a6; font-size: 13px">{{ item.secondPerson }}-{{ item.secondPhone }}</span>
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="签订日期" prop="signDate">
            <el-date-picker v-model="form.signDate" type="date" style="width: 200px;" />
          </el-form-item>
          <el-form-item label="所属地区" prop="contractArea">
            <el-cascader
              v-model="selectedAreaOptions"
              size="large"
              :options="areaOptions"
              style="width: 200px;"
              @change="areaChange"
            />
          </el-form-item>
          <el-form-item label="起始日期" prop="startDate">
            <el-date-picker v-model="form.startDate" type="date" style="width: 200px;" />
          </el-form-item>
          <el-form-item label="截止日期" prop="endDate">
            <el-date-picker v-model="form.endDate" type="date" style="width: 200px;" />
          </el-form-item>
          <el-form-item label="合同类型" prop="contractType">
            <el-select v-model="form.contractType" filterable placeholder="请选择" style="width: 200px;" @change="contractTypeChange">
              <el-option
                v-for="item in dict[contractType]"
                :key="item.id"
                :label="item.label"
                :value="item.value"
              />
            </el-select>
          </el-form-item>
          <el-form-item label="合同内容" prop="contractContent">
            <el-input v-model="form.contractContent" style="width: 200px;" />
          </el-form-item>
          <span v-if="form.contractType != contractService && form.contractType != null && form.contractType != ''">
            <el-divider>合同费用数据</el-divider>
            <el-form-item label="合同费金额" prop="contractAmount">
              <money-input :key="random" v-model="form.contractAmount" :width="535" />
            </el-form-item>
            <el-form-item label="预计付款日期" prop="contractPaymentDate">
              <el-date-picker v-model="form.contractPaymentDate" type="date" style="width: 200px;" />
            </el-form-item>
            <el-form-item label="付款状态" prop="contractPaymentState">
              <el-select v-model="form.contractPaymentState" filterable placeholder="请选择" style="width: 200px;">
                <el-option
                  v-for="item in dict[paymentState]"
                  :key="item.id"
                  :label="item.label"
                  :value="item.value"
                />
              </el-select>
            </el-form-item>
          </span>
          <span v-if="form.contractType == contractService || form.contractType == contractDevelopService">
            <el-divider>运维服务费用数据</el-divider>
            <el-form-item v-if="form.contractType == contractDevelopService" label="服务开始日期" prop="serviceStartsDate">
              <el-date-picker v-model="form.serviceStartsDate" type="date" style="width: 535px;" />
            </el-form-item>
            <el-form-item label="运维服务费金额" prop="serviceAmount">
              <money-input :key="random" v-model="form.serviceAmount" :width="535" />
            </el-form-item>
            <el-form-item label="预计付款日期" prop="servicePaymentDate">
              <el-date-picker v-model="form.servicePaymentDate" type="date" style="width: 200px;" />
            </el-form-item>
            <el-form-item label="付款状态" prop="servicePaymentState">
              <el-select v-model="form.servicePaymentState" filterable placeholder="请选择" style="width: 200px;">
                <el-option
                  v-for="item in dict[paymentState]"
                  :key="item.id"
                  :label="item.label"
                  :value="item.value"
                />
              </el-select>
            </el-form-item>
          </span>
          <el-form-item label="合同初版文件" prop="relatedDocumentsFirst">
            <file-upload :key="random" ref="fileFirstUpload" :file-url="form.relatedDocumentsFirst == null || form.relatedDocumentsFirst === '' ? null : form.relatedDocumentsFirst" :limit="5" @fileInfo="getFirstFileInfo" />
          </el-form-item>
          <el-form-item label="合同终版文件" prop="relatedDocumentsFinal">
            <file-upload :key="random" ref="fileFinalUpload" :file-url="form.relatedDocumentsFinal == null || form.relatedDocumentsFinal === '' ? null : form.relatedDocumentsFinal" :limit="5" @fileInfo="getFinalFileInfo" />
          </el-form-item>
          <el-form-item label="合同状态" prop="contractStatus">
            <el-select v-model="form.contractStatus" filterable placeholder="请选择" style="width: 200px;">
              <el-option
                v-for="item in dict[contractStatus]"
                :key="item.id"
                :label="item.label"
                :value="item.value"
              />
            </el-select>
          </el-form-item>
          <el-form-item label="备注信息" prop="remarks">
            <el-input v-model="form.remarks" :rows="3" type="textarea" style="width: 535px;" />
          </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer">
          <el-button type="text" @click="crud.cancelCU">取消</el-button>
          <el-button :loading="crud.status.cu === 2" type="primary" @click="submitCU">确认</el-button>
        </div>
      </el-dialog>
      <!--表格渲染-->
      <el-table ref="table" v-loading="crud.loading" :data="crud.data" stripe size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
        <el-table-column type="selection" width="55" />
        <el-table-column fixed="left" type="expand">
          <template slot-scope="props">
            <el-form label-position="left" class="my-demo-table-expand" style="margin-left: 264px;">
              <template v-if="props.row.contractType != contractService">
                <el-form-item label="合同费">
                  <span>{{ crud.toMoney(props.row.contractPaymentAmount) }} / {{ crud.toMoney(props.row.contractAmount) }}</span>
                </el-form-item>
              </template>
              <template v-if="props.row.contractType == contractService || props.row.contractType == contractDevelopService">
                <el-form-item
                  v-for="item in (parseInt(crud.toDate(new Date()).substring(0,4)) - parseInt(crud.toDate(props.row.serviceStartsDate).substring(0,4)) + 1)"
                  :key="item"
                  :label="
                    (parseInt(crud.toDate(props.row.serviceStartsDate).substring(0,4)) + (item - 1)) +
                      crud.toDate(props.row.serviceStartsDate).substring(4,10) +
                      ' ~ ' +
                      (
                        crud.toDate(new Date(props.row.serviceStartsDate).getTime() - 24 * 60 * 60 * 1000).substring(4,10) == '-12-31' ?
                          (parseInt(crud.toDate(props.row.serviceStartsDate).substring(0,4)) + (item - 1)) +
                          crud.toDate(new Date(props.row.serviceStartsDate).getTime() - 24 * 60 * 60 * 1000).substring(4,10) :
                          (parseInt(crud.toDate(props.row.serviceStartsDate).substring(0,4)) + item) +
                          crud.toDate(new Date(props.row.serviceStartsDate).getTime() - 24 * 60 * 60 * 1000).substring(4,10)
                      ) +
                      ' 运维服务费'"
                >
                  <span>{{ crud.toMoney(props.row.servicePaymentAmount.split('、')[item - 1]) }} / {{ crud.toMoney(props.row.serviceAmount) }}</span>
                </el-form-item>
              </template>
            </el-form>
          </template>
        </el-table-column>
        <el-table-column fixed="left" :show-overflow-tooltip="true" prop="contractNumber" label="合同编号" width="100" />
        <el-table-column fixed="left" :show-overflow-tooltip="true" prop="contractName" label="合同名称" width="100" />
        <el-table-column :show-overflow-tooltip="true" prop="firstName" label="所属甲方" width="100" />
        <el-table-column :show-overflow-tooltip="true" prop="secondName" label="所属乙方" width="100" />
        <el-table-column :show-overflow-tooltip="true" prop="signDate" label="签订日期" width="100">
          <template slot-scope="scope">
            {{ crud.toDate(scope.row.signDate) }}
          </template>
        </el-table-column>
        <el-table-column label="发票详情">
          <template slot-scope="scope">
            <el-link type="info" @click="goContractInvoice(scope.row.contractId)">点击查看</el-link>
          </template>
        </el-table-column>
        <el-table-column label="付款详情">
          <template slot-scope="scope">
            <el-link type="info" @click="goContractPayment(scope.row.contractId)">点击查看</el-link>
          </template>
        </el-table-column>
        <el-table-column :show-overflow-tooltip="true" prop="billingTotalAmount" label="开票总金额" width="100">
          <template slot-scope="scope">
            {{ crud.toMoney(scope.row.billingTotalAmount) }}
          </template>
        </el-table-column>
        <el-table-column :show-overflow-tooltip="true" prop="paymentTotalAmount" label="付款总金额" width="100">
          <template slot-scope="scope">
            {{ crud.toMoney(scope.row.paymentTotalAmount) }}
          </template>
        </el-table-column>
        <el-table-column :show-overflow-tooltip="true" prop="advancePayment" label="预收款金额" width="100">
          <template slot-scope="scope">
            <span v-if="scope.row.advancePayment != null && scope.row.advancePayment != 0" style="color: red;">
              {{ crud.toMoney(scope.row.advancePayment) }}
            </span>
          </template>
        </el-table-column>
        <el-table-column :show-overflow-tooltip="true" prop="receivePayment" label="应收款金额" width="100">
          <template slot-scope="scope">
            <span v-if="scope.row.receivePayment != null && scope.row.receivePayment != 0" style="color: red;">
              {{ crud.toMoney(scope.row.receivePayment) }}
            </span>
          </template>
        </el-table-column>
        <el-table-column label="合同费数据">
          <el-table-column :show-overflow-tooltip="true" prop="contractAmount" label="合同费金额" width="100">
            <template slot-scope="scope">
              <span v-if="scope.row.contractAmount != null && scope.row.contractAmount != 0">
                {{ crud.toMoney(scope.row.contractAmount) }}
              </span>
            </template>
          </el-table-column>
          <el-table-column :show-overflow-tooltip="true" prop="contractPaymentDate" label="预计付款日期" width="100">
            <template slot-scope="scope">
              {{ crud.toDate(scope.row.contractPaymentDate) }}
            </template>
          </el-table-column>
          <el-table-column :show-overflow-tooltip="true" prop="contractPaymentState" label="付款状态" width="100">
            <template slot-scope="scope">
              {{ dict.label[paymentState][scope.row.contractPaymentState] }}
            </template>
          </el-table-column>
          <el-table-column :show-overflow-tooltip="true" prop="contractPostponement" label="延期情况" width="100">
            <template slot-scope="scope">
              <span style="color: red;">{{ scope.row.contractPostponement }}</span>
            </template>
          </el-table-column>
        </el-table-column>
        <el-table-column label="运维服务费数据">
          <el-table-column :show-overflow-tooltip="true" prop="serviceStartsDate" label="服务开始日期" width="100">
            <template slot-scope="scope">
              {{ crud.toDate(scope.row.serviceStartsDate) }}
            </template>
          </el-table-column>
          <el-table-column :show-overflow-tooltip="true" prop="serviceAmount" label="运维服务费金额" width="110">
            <template slot-scope="scope">
              <span v-if="scope.row.serviceAmount != null && scope.row.serviceAmount != 0">
                {{ crud.toMoney(scope.row.serviceAmount) }}
              </span>
            </template>
          </el-table-column>
          <el-table-column :show-overflow-tooltip="true" prop="servicePaymentDate" label="预计付款日期" width="100">
            <template slot-scope="scope">
              {{ crud.toMonthDay(scope.row.servicePaymentDate) }}
            </template>
          </el-table-column>
          <el-table-column :show-overflow-tooltip="true" prop="servicePaymentState" label="付款状态" width="100">
            <template slot-scope="scope">
              {{ dict.label[paymentState][scope.row.servicePaymentState] }}
            </template>
          </el-table-column>
          <el-table-column :show-overflow-tooltip="true" prop="servicePostponement" label="延期情况" width="100">
            <template slot-scope="scope">
              <span style="color: red;">{{ scope.row.servicePostponement }}</span>
            </template>
          </el-table-column>
        </el-table-column>
        <el-table-column :show-overflow-tooltip="true" prop="startDate" label="起始日期" width="100">
          <template slot-scope="scope">
            {{ crud.toDate(scope.row.startDate) }}
          </template>
        </el-table-column>
        <el-table-column :show-overflow-tooltip="true" prop="endDate" label="截止日期" width="100">
          <template slot-scope="scope">
            {{ crud.toDate(scope.row.endDate) }}
          </template>
        </el-table-column>
        <el-table-column :show-overflow-tooltip="true" prop="contractArea" label="所属地区" width="100" />
        <el-table-column :show-overflow-tooltip="true" prop="contractType" label="合同类型" width="100">
          <template slot-scope="scope">
            {{ dict.label[contractType][scope.row.contractType] }}
          </template>
        </el-table-column>
        <el-table-column :show-overflow-tooltip="true" prop="contractContent" label="合同内容" width="100" />
        <el-table-column :show-overflow-tooltip="true" prop="remarks" label="备注信息" width="100" />
        <el-table-column fixed="right" :show-overflow-tooltip="true" prop="contractStatus" label="合同状态" width="100">
          <template slot-scope="scope">
            {{ dict.label[contractStatus][scope.row.contractStatus] }}
          </template>
        </el-table-column>
        <el-table-column v-if="checkPer(['admin','contract:edit','contract:del'])" fixed="right" label="操作" width="150px" align="center">
          <template slot-scope="scope">
            <udOperation
              :data="scope.row"
              :permission="permission"
            />
          </template>
        </el-table-column>
      </el-table>
      <!--分页组件-->
      <pagination />
    </div>
  </div>
</template>
<script>
import crudContract from '@/api/contract/contract'
import CRUD, { presenter, header, form, crud } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination'
import crudContractFirst from '@/api/contract/contractFirst'
import crudContractSecond from '@/api/contract/contractSecond'
import { regionData, CodeToText } from 'element-china-area-data'
import moneyInput from '../../assembly/moneyInput/index.vue'
import fileUpload from '../../assembly/fileUpload/index.vue'
import DateRangePicker from '@/components/DateRangePicker'
import constant from '../../../utils/constant'
import { contractTotalMoney, contractDelayTotalAmount, contractDelayTotalMoney, advancePaymentTotalMoney } from '@/api/contract/contract'
import { serviceTotalMoney, serviceDelayTotalAmount, serviceDelayTotalMoney, receivePaymentTotalMoney } from '@/api/contract/contract'
const defaultForm = { contractId: null, contractNumber: null, contractName: null, firstId: null, secondId: null, signDate: null, startDate: null, endDate: null, contractAreaCode: null, contractArea: null, contractType: null, contractContent: null, contractAmount: null, contractPaymentDate: null, contractPaymentState: null, serviceStartsDate: null, serviceAmount: null, servicePaymentDate: null, servicePaymentState: null, relatedDocumentsFirst: null, relatedDocumentsFinal: null, contractStatus: null, remarks: null, createBy: null, updateBy: null, createTime: null, updateTime: null }
export default {
  name: 'InServiceContract',
  components: { pagination, crudOperation, rrOperation, udOperation, moneyInput, fileUpload, DateRangePicker },
  mixins: [presenter(), header(), form(defaultForm), crud()],
  dicts: [constant.CONTRACT_TYPE, constant.PAYMENT_STATE, constant.CONTRACT_STATUS],
  cruds() {
    return CRUD({ title: '合同详情', url: 'api/contract', idField: 'contractId', sort: 'contractId,desc', crudMethod: { ...crudContract }})
  },
  data() {
    // 合同费金额校验规则
    var validateContractAmount = (rule, value, callback) => {
      if (value !== null) {
        if (isNaN(Number(value))) {
          callback(new Error('请输入数字值'))
        } else {
          if (value < 0 || value > 1000000000) {
            callback(new Error('合同费金额不能超过10亿'))
          } else {
            callback()
          }
        }
      } else {
        callback(new Error('合同费金额不能为空'))
      }
    }
    // 服务费金额校验规则
    var validateServiceAmount = (rule, value, callback) => {
      if (value !== null) {
        if (isNaN(Number(value))) {
          callback(new Error('请输入数字值'))
        } else {
          if (value < 0 || value > 1000000000) {
            callback(new Error('服务费金额不能超过10亿'))
          } else {
            callback()
          }
        }
      } else {
        callback(new Error('服务费金额不能为空'))
      }
    }
    return {
      permission: {
        add: ['admin', 'contract:add'],
        edit: ['admin', 'contract:edit'],
        del: ['admin', 'contract:del'],
        download: ['admin', 'contract:download']
      },
      rules: {
        contractName: [
          { required: true, message: '请输入合同名称', trigger: 'blur' },
          { min: 2, max: 100, message: '长度在 2 到 100 个字符', trigger: 'blur' }
        ],
        firstId: [
          { required: true, message: '请选择所属甲方', trigger: 'change' }
        ],
        secondId: [
          { required: true, message: '请选择所属乙方', trigger: 'change' }
        ],
        signDate: [
          { required: true, message: '请选择签订日期', trigger: 'change' }
        ],
        startDate: [
          { required: true, message: '请选择起始日期', trigger: 'change' }
        ],
        endDate: [
          { required: true, message: '请选择截止日期', trigger: 'change' }
        ],
        contractArea: [
          { required: true, message: '请选择所属地区', trigger: 'change' }
        ],
        contractType: [
          { required: true, message: '请选择合同类型', trigger: 'change' }
        ],
        contractContent: [
          { min: 2, max: 50, message: '长度在 2 到 50 个字符', trigger: 'blur' }
        ],
        contractAmount: [
          { required: true, validator: validateContractAmount, trigger: 'blur' }
        ],
        contractPaymentDate: [
          { required: true, message: '请选择预计付款日期', trigger: 'change' }
        ],
        contractPaymentState: [
          { required: true, message: '请选择付款状态', trigger: 'change' }
        ],
        serviceStartsDate: [
          { required: true, message: '请选择服务开始日期', trigger: 'change' }
        ],
        serviceAmount: [
          { required: true, validator: validateServiceAmount, trigger: 'blur' }
        ],
        servicePaymentDate: [
          { required: true, message: '请选择预计付款日期', trigger: 'change' }
        ],
        servicePaymentState: [
          { required: true, message: '请选择付款状态', trigger: 'change' }
        ],
        contractStatus: [
          { required: true, message: '请选择合同状态', trigger: 'change' }
        ]
      },
      queryTypeOptions: [
        { key: 'contractNumber', display_name: '合同编号' },
        { key: 'contractName', display_name: '合同名称' },
        { key: 'firstId', display_name: '所属甲方' },
        { key: 'secondId', display_name: '所属乙方' },
        { key: 'signDate', display_name: '签订日期' },
        { key: 'contractType', display_name: '合同类型' },
        { key: 'contractPaymentState', display_name: '付款状态' },
        { key: 'servicePaymentState', display_name: '付款状态' },
        { key: 'contractStatus', display_name: '合同状态' },
        { key: 'contractAreaCode', display_name: '所属地区' },
        { key: 'provincial', display_name: '省级' },
        { key: 'city', display_name: '市级' },
        { key: 'region', display_name: '区级' }
      ],
      // 字典:合同类型
      contractType: constant.CONTRACT_TYPE,
      // 字典:合同类型-服务合同(年)
      contractService: constant.CONTRACT_SERVICE,
      // 字典:合同类型-开发服务合同
      contractDevelopService: constant.CONTRACT_DEVELOP_SERVICE,
      // 字典:付款状态
      paymentState: constant.PAYMENT_STATE,
      // 字典:合同状态
      contractStatus: constant.CONTRACT_STATUS,
      // 甲方数据
      customerFirst: [],
      // 乙方数据
      customerSecond: [],
      // 所属地区数据
      areaOptions: regionData,
      // 选中地区数据
      selectedAreaOptions: [],
      // 随机数
      random: 0,
      // 提交触发次数
      triggerCount: 0,
      // 搜索选择市级列表
      queryCityList: [],
      // 搜索选择区级列表
      queryRegionList: [],
      // 合同款总金额
      contractTotalMoney: 0,
      // 合同款延期数
      contractDelayTotalAmount: 0,
      // 合同款延期金额
      contractDelayTotalMoney: 0,
      // 预收款总金额
      advancePaymentTotalMoney: 0,
      // 运维服务总金额
      serviceTotalMoney: 0,
      // 运维服务延期数
      serviceDelayTotalAmount: 0,
      // 运维服务延期金额
      serviceDelayTotalMoney: 0,
      // 应收款总金额
      receivePaymentTotalMoney: 0
    }
  },
  watch: {
    'crud.query.contractAreaCode'(val) {
      // 判断是否为空
      if (val == null) {
        // 搜索选择市级列表
        this.queryCityList = []
        // 搜索选择区级列表
        this.queryRegionList = []
      }
    }
  },
  methods: {
    // 钩子:在获取表格数据之前执行,false 则代表不获取数据
    [CRUD.HOOK.beforeRefresh]() {
      // 获取甲方数据
      this.getCustomerFirst()
      // 获取乙方数据
      this.getCustomerSecond()
      // 获取合同款总金额
      this.getContractTotalMoney()
      // 获取合同款延期数
      this.getContractDelayTotalAmount()
      // 获取合同款延期金额
      this.getContractDelayTotalMoney()
      // 获取预收款总金额
      this.getAdvancePaymentTotalMoney()
      // 获取运维服务总金额
      this.getServiceTotalMoney()
      // 获取运维服务延期数
      this.getServiceDelayTotalAmount()
      // 获取运维服务延期金额
      this.getServiceDelayTotalMoney()
      // 获取应收款总金额
      this.getReceivePaymentTotalMoney()
      return true
    },
    // 钩子:开始 "新建/编辑" - 之前
    [CRUD.HOOK.beforeToCU]() {
      const that = this
      // 选中地区数据置空
      that.selectedAreaOptions = []
      // 判断所属地区编码是否为空
      if (that.crud.form.contractAreaCode !== null && that.crud.form.contractAreaCode !== '') {
        // 选中地区数据赋值
        that.selectedAreaOptions = that.crud.form.contractAreaCode.split('/')
      }
      // 随机数
      that.random = Math.random()
    },
    // 获取甲方数据
    getCustomerFirst() {
      const that = this
      // 获取甲方数据
      crudContractFirst.getAll().then(res => {
        // 获取甲方数据
        that.customerFirst = res
      })
    },
    // 获取乙方数据
    getCustomerSecond() {
      const that = this
      // 获取乙方数据
      crudContractSecond.getAll().then(res => {
        // 获取乙方数据
        that.customerSecond = res
      })
    },
    // 地区选择触发
    areaChange(arr) {
      const that = this
      // 所属地区编码赋值
      that.crud.form.contractAreaCode = arr[0] + '/' + arr[1] + '/' + arr[2]
      // 所属地区赋值
      that.crud.form.contractArea = CodeToText[arr[0]] + '/' + CodeToText[arr[1]] + '/' + CodeToText[arr[2]]
    },
    // 合同类型变更
    contractTypeChange() {
      const that = this
      // 随机数
      that.random = Math.random()
    },
    // 表单提交
    submitCU() {
      const that = this
      // 提交触发次数
      that.triggerCount = 0
      // 通过“that.$refs.fileFirstUpload”找到子页面,“submit”是子页面的方法。
      that.$refs.fileFirstUpload.submit()
      // 通过“that.$refs.fileFinalUpload”找到子页面,“submit”是子页面的方法。
      that.$refs.fileFinalUpload.submit()
    },
    // 获取文件信息
    getFirstFileInfo(info) {
      const that = this
      // 判断返回数据
      if (info.length === 0) {
        // 表单文件路径赋值
        that.crud.form.relatedDocumentsFirst = null
        // 表单提交
        that.referSubmitCU()
        // 终止
        return
      }
      // 循环返回数据
      for (let i = 0; i < info.length; i++) {
        // 判断循环下标
        if (i === 0) {
          // 表单文件路径赋值
          that.crud.form.relatedDocumentsFirst = info[i].response == null || info[i].response === '' ? info[i].url.substring(info[i].url.indexOf('/file/'), info[i].url.length) : '/file/' + info[i].response.type + '/' + info[i].response.realName
        } else {
          // 表单文件路径赋值
          that.crud.form.relatedDocumentsFirst += info[i].response == null || info[i].response === '' ? ',' + info[i].url.substring(info[i].url.indexOf('/file/'), info[i].url.length) : ',/file/' + info[i].response.type + '/' + info[i].response.realName
        }
        // 判断循环是否结束
        if (i === info.length - 1) {
          // 表单提交
          that.referSubmitCU()
        }
      }
    },
    // 获取文件信息
    getFinalFileInfo(info) {
      const that = this
      // 判断返回数据
      if (info.length === 0) {
        // 表单文件路径赋值
        that.crud.form.relatedDocumentsFinal = null
        // 表单提交
        that.referSubmitCU()
        // 终止
        return
      }
      // 循环返回数据
      for (let i = 0; i < info.length; i++) {
        // 判断循环下标
        if (i === 0) {
          // 表单文件路径赋值
          that.crud.form.relatedDocumentsFinal = info[i].response == null || info[i].response === '' ? info[i].url.substring(info[i].url.indexOf('/file/'), info[i].url.length) : '/file/' + info[i].response.type + '/' + info[i].response.realName
        } else {
          // 表单文件路径赋值
          that.crud.form.relatedDocumentsFinal += info[i].response == null || info[i].response === '' ? ',' + info[i].url.substring(info[i].url.indexOf('/file/'), info[i].url.length) : ',/file/' + info[i].response.type + '/' + info[i].response.realName
        }
        // 判断循环是否结束
        if (i === info.length - 1) {
          // 表单提交
          that.referSubmitCU()
        }
      }
    },
    // 表单提交
    referSubmitCU() {
      const that = this
      // 提交触发次数自增
      that.triggerCount++
      // 判断提交触发次数
      if (that.triggerCount === 2) {
        // 表单提交
        that.crud.submitCU()
      }
    },
    // 跳转合同发票详情
    goContractInvoice(contractId) {
      const that = this
      // 跳转合同发票详情页面
      that.$router.push({ path: '/contract/contractInvoice', query: { contractId: contractId }})
    },
    // 跳转合同付款详情
    goContractPayment(contractId) {
      const that = this
      // 跳转合同付款详情页面
      that.$router.push({ path: '/contract/contractPayment', query: { contractId: contractId }})
    },
    // 搜索省级变更
    queryProvincialChange(event) {
      const that = this
      // 搜索选择省级
      that.$set(that.crud.query, 'provincial', event)
      // 搜索选择市级
      that.$set(that.crud.query, 'city', null)
      // 搜索选择区级
      that.$set(that.crud.query, 'region', null)
      // 搜索选择市级列表
      that.queryCityList = []
      // 搜索选择区级列表
      that.queryRegionList = []
      // 所属地区编码赋值
      that.$set(that.crud.query, 'contractAreaCode', that.crud.query.provincial)
      // 循环所属地区数据
      that.areaOptions.forEach(function(item) {
        // 判断是否为选中市级
        if (item.value === that.crud.query.provincial) {
          // 搜索选择市级列表
          that.queryCityList = item.children
        }
      })
    },
    // 搜索市级变更
    queryCityChange(event) {
      const that = this
      // 搜索选择市级
      that.$set(that.crud.query, 'city', event)
      // 搜索选择区级
      that.$set(that.crud.query, 'region', null)
      // 搜索选择区级列表
      that.queryRegionList = []
      // 所属地区编码赋值
      that.$set(that.crud.query, 'contractAreaCode', that.crud.query.provincial + '/' + that.crud.query.city)
      // 搜索选择市级列表
      that.queryCityList.forEach(function(item) {
        // 判断是否为选中市级
        if (item.value === that.crud.query.city) {
          // 搜索选择区级列表
          that.queryRegionList = item.children
        }
      })
    },
    // 搜索区级变更
    queryRegionChange(event) {
      const that = this
      // 搜索选择区级
      that.$set(that.crud.query, 'region', event)
      // 所属地区编码赋值
      that.$set(that.crud.query, 'contractAreaCode', that.crud.query.provincial + '/' + that.crud.query.city + '/' + that.crud.query.region)
    },
    // 获取合同款总金额
    getContractTotalMoney() {
      // 获取合同款总金额
      contractTotalMoney({ ...this.crud.query }).then(res => {
        // 合同款总金额
        this.contractTotalMoney = res
      })
    },
    // 获取合同款延期数
    getContractDelayTotalAmount() {
      // 获取合同款延期数
      contractDelayTotalAmount({ ...this.crud.query }).then(res => {
        // 合同款延期数
        this.contractDelayTotalAmount = res
      })
    },
    // 获取合同款延期金额
    getContractDelayTotalMoney() {
      // 获取合同款延期金额
      contractDelayTotalMoney({ ...this.crud.query }).then(res => {
        // 合同款延期金额
        this.contractDelayTotalMoney = res
      })
    },
    // 获取预收款总金额
    getAdvancePaymentTotalMoney() {
      // 获取预收款总金额
      advancePaymentTotalMoney({ ...this.crud.query }).then(res => {
        // 预收款总金额
        this.advancePaymentTotalMoney = res
      })
    },
    // 获取运维服务总金额
    getServiceTotalMoney() {
      // 获取运维服务总金额
      serviceTotalMoney({ ...this.crud.query }).then(res => {
        // 运维服务总金额
        this.serviceTotalMoney = res
      })
    },
    // 获取运维服务延期数
    getServiceDelayTotalAmount() {
      // 获取运维服务延期数
      serviceDelayTotalAmount({ ...this.crud.query }).then(res => {
        // 运维服务延期数
        this.serviceDelayTotalAmount = res
      })
    },
    // 获取运维服务延期金额
    getServiceDelayTotalMoney() {
      // 获取运维服务延期金额
      serviceDelayTotalMoney({ ...this.crud.query }).then(res => {
        // 运维服务延期金额
        this.serviceDelayTotalMoney = res
      })
    },
    // 获取应收款总金额
    getReceivePaymentTotalMoney() {
      // 获取应收款总金额
      receivePaymentTotalMoney({ ...this.crud.query }).then(res => {
        // 应收款总金额
        this.receivePaymentTotalMoney = res
      })
    }
  }
}
</script>
<style scoped>
</style>
eladmin-web-master/src/views/contract/contractFirst/index.vue
New file
@@ -0,0 +1,203 @@
<template>
  <div class="app-container">
    <!--工具栏-->
    <div class="head-container">
      <div v-if="crud.props.searchToggle">
        <!-- 搜索 -->
        <el-input v-model="query.firstName" clearable placeholder="甲方" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
        <rrOperation :crud="crud" />
      </div>
      <!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
      <crudOperation :permission="permission" />
      <!--表单组件-->
      <el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="630px">
        <el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="80px">
          <el-form-item label="甲方" prop="firstName">
            <el-input v-model="form.firstName" style="width: 495px;" />
          </el-form-item>
          <el-form-item label="联系人" prop="firstPerson">
            <el-input v-model="form.firstPerson" style="width: 200px;" />
          </el-form-item>
          <el-form-item label="联系电话" prop="firstPhone">
            <el-input v-model="form.firstPhone" style="width: 200px;" />
          </el-form-item>
          <el-form-item label="邮箱" prop="firstEmail">
            <el-input v-model="form.firstEmail" style="width: 200px;" />
          </el-form-item>
          <el-form-item label="传真" prop="firstFax">
            <el-input v-model="form.firstFax" style="width: 200px;" />
          </el-form-item>
          <el-form-item label="所在地区" prop="firstArea">
            <el-cascader
              v-model="selectedAreaOptions"
              size="large"
              :options="areaOptions"
              style="width: 495px;"
              @change="areaChange"
            />
          </el-form-item>
          <el-form-item label="详细地址" prop="firstAddress">
            <el-input v-model="form.firstAddress" :rows="3" type="textarea" style="width: 495px;" />
          </el-form-item>
          <el-form-item label="备注信息" prop="remarks">
            <el-input v-model="form.remarks" :rows="3" type="textarea" style="width: 495px;" />
          </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer">
          <el-button type="text" @click="crud.cancelCU">取消</el-button>
          <el-button :loading="crud.status.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
        </div>
      </el-dialog>
      <!--表格渲染-->
      <el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
        <el-table-column type="selection" width="55" />
        <el-table-column :show-overflow-tooltip="true" prop="firstName" label="甲方" />
        <el-table-column :show-overflow-tooltip="true" prop="firstPerson" label="联系人" />
        <el-table-column :show-overflow-tooltip="true" prop="firstPhone" label="联系电话" />
        <el-table-column :show-overflow-tooltip="true" prop="firstEmail" label="邮箱" />
        <el-table-column :show-overflow-tooltip="true" prop="firstFax" label="传真" />
        <el-table-column :show-overflow-tooltip="true" prop="firstArea" label="所在地区" />
        <el-table-column :show-overflow-tooltip="true" prop="firstAddress" label="详细地址" />
        <el-table-column :show-overflow-tooltip="true" prop="remarks" label="备注信息" />
        <el-table-column v-if="checkPer(['admin','contractFirst:edit','contractFirst:del'])" label="操作" width="150px" align="center">
          <template slot-scope="scope">
            <udOperation
              :data="scope.row"
              :permission="permission"
            />
          </template>
        </el-table-column>
      </el-table>
      <!--分页组件-->
      <pagination />
    </div>
  </div>
</template>
<script>
import crudContractFirst from '@/api/contract/contractFirst'
import CRUD, { presenter, header, form, crud } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination'
import { regionData, CodeToText } from 'element-china-area-data'
const defaultForm = { firstId: null, firstName: null, firstPerson: null, firstPhone: null, firstEmail: null, firstFax: null, firstAreaCode: null, firstArea: null, firstAddress: null, remarks: null, createBy: null, updateBy: null, createTime: null, updateTime: null }
export default {
  name: 'ContractFirst',
  components: { pagination, crudOperation, rrOperation, udOperation },
  mixins: [presenter(), header(), form(defaultForm), crud()],
  cruds() {
    return CRUD({ title: '合同甲方', url: 'api/contractFirst', idField: 'firstId', sort: 'firstId,desc', crudMethod: { ...crudContractFirst }})
  },
  data() {
    // 联系电话验证
    var validateFirstPhone = (rule, value, callback) => {
      if (value) {
        const reg = /^((0\d{2,3}-\d{7,8})|(1[34578]\d{9}))$/
        if (!reg.test(value)) {
          callback(new Error('请输入正确的手机号或者座机号格式'))
        }
        callback()
      } else {
        callback(new Error('请输入联系电话'))
      }
    }
    // 邮箱验证
    var validateFirstEmail = (rule, value, callback) => {
      if (value) {
        const reg = /^([a-zA-Z0-9]+[-_\.]?)+@[a-zA-Z0-9]+\.[a-z]+$/
        if (!reg.test(value)) {
          callback(new Error('请输入正确的邮箱格式'))
        }
        callback()
      } else {
        callback()
      }
    }
    // 传真验证
    var validateFirstFax = (rule, value, callback) => {
      if (value) {
        const reg = /^(\d{3,4}-)?\d{7,8}$/
        if (!reg.test(value)) {
          callback(new Error('请输入正确的传真格式'))
        }
        callback()
      } else {
        callback()
      }
    }
    return {
      permission: {
        add: ['admin', 'contractFirst:add'],
        edit: ['admin', 'contractFirst:edit'],
        del: ['admin', 'contractFirst:del'],
        download: ['admin', 'contractFirst:download']
      },
      rules: {
        firstName: [
          { required: true, message: '请输入甲方', trigger: 'blur' },
          { min: 2, max: 100, message: '长度在 2 到 100 个字符', trigger: 'blur' }
        ],
        firstPerson: [
          { required: true, message: '请输入联系人', trigger: 'blur' },
          { min: 2, max: 10, message: '长度在 2 到 10 个字符', trigger: 'blur' }
        ],
        firstPhone: [
          { required: true, validator: validateFirstPhone, trigger: 'blur' }
        ],
        firstEmail: [
          { validator: validateFirstEmail, trigger: 'blur' }
        ],
        firstFax: [
          { validator: validateFirstFax, trigger: 'blur' }
        ],
        firstArea: [
          { required: true, message: '请选择所在地区', trigger: 'blur' }
        ],
        firstAddress: [
          { required: true, message: '请输入详细地址', trigger: 'blur' },
          { min: 2, max: 100, message: '长度在 2 到 100 个字符', trigger: 'blur' }
        ]
      },
      queryTypeOptions: [
        { key: 'firstName', display_name: '甲方' }
      ],
      // 所属地区数据
      areaOptions: regionData,
      // 选中地区数据
      selectedAreaOptions: []
    }
  },
  methods: {
    // 钩子:在获取表格数据之前执行,false 则代表不获取数据
    [CRUD.HOOK.beforeRefresh]() {
      return true
    },
    // 钩子:开始 "新建/编辑" - 之前
    [CRUD.HOOK.beforeToCU]() {
      const that = this
      // 选中地区数据置空
      that.selectedAreaOptions = []
      // 判断所在地区编码是否为空
      if (that.crud.form.firstAreaCode !== null && that.crud.form.firstAreaCode !== '') {
        // 选中地区数据赋值
        that.selectedAreaOptions = that.crud.form.firstAreaCode.split('/')
      }
    },
    // 地区选择触发
    areaChange(arr) {
      const that = this
      // 所在地区编码赋值
      that.crud.form.firstAreaCode = arr[0] + '/' + arr[1] + '/' + arr[2]
      // 所在地区赋值
      that.crud.form.firstArea = CodeToText[arr[0]] + '/' + CodeToText[arr[1]] + '/' + CodeToText[arr[2]]
    }
  }
}
</script>
<style scoped>
</style>
eladmin-web-master/src/views/contract/contractInvoice/index.vue
New file
@@ -0,0 +1,368 @@
<template>
  <div class="app-container">
    <!--工具栏-->
    <div class="head-container">
      <div v-if="crud.props.searchToggle">
        <!-- 搜索 -->
        <el-select v-model="query.contractId" filterable clearable placeholder="所属合同" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery">
          <el-option
            v-for="item in contractList"
            :key="item.contractId"
            :label="item.contractNumber + ' - ' + item.contractName"
            :value="item.contractId"
          />
        </el-select>
        <el-select v-model="query.invoiceType" filterable clearable placeholder="发票类型" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery">
          <el-option
            v-for="item in dict[invoiceType]"
            :key="item.id"
            :label="item.label"
            :value="item.value"
          />
        </el-select>
        <rrOperation :crud="crud" />
      </div>
      <!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
      <crudOperation :permission="permission" />
      <!--表单组件-->
      <el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="630px">
        <el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="80px">
          <el-form-item label="所属合同" prop="contractId">
            <el-select v-model="form.contractId" filterable clearable placeholder="请选择" style="width: 495px;" @change="contractIdChange">
              <el-option
                v-for="item in contractList"
                :key="item.contractId"
                :label="item.contractNumber + ' - ' + item.contractName"
                :value="item.contractId"
              />
            </el-select>
          </el-form-item>
          <el-form-item label="开票时间" prop="billingTime">
            <el-date-picker v-model="form.billingTime" type="datetime" style="width: 200px;" />
          </el-form-item>
          <el-form-item label="发票类型" prop="invoiceType">
            <el-select v-model="form.invoiceType" filterable placeholder="请选择" style="width: 200px;">
              <el-option
                v-for="item in dict[invoiceType]"
                :key="item.id"
                :label="item.label"
                :value="item.value"
              />
            </el-select>
          </el-form-item>
          <el-form-item label="税前金额" prop="beforeTaxAmount">
            <money-input :key="random" v-model="form.beforeTaxAmount" :width="200" @change="amountOrRateChange" />
          </el-form-item>
          <el-form-item label="税率" prop="taxRate">
            <el-input v-model="form.taxRate" style="width: 200px;" @change="amountOrRateChange">
              <template slot="append">%</template>
            </el-input>
          </el-form-item>
          <el-form-item label="税额" prop="taxAmount">
            <money-input :key="randomAR" v-model="form.taxAmount" :width="200" />
          </el-form-item>
          <el-form-item label="税后金额" prop="afterTaxAmount">
            <money-input :key="randomAR" v-model="form.afterTaxAmount" :width="200" />
          </el-form-item>
          <el-form-item label="相关文件" prop="relatedDocuments">
            <file-upload :key="random" ref="fileUpload" :file-url="form.relatedDocuments == null || form.relatedDocuments === '' ? null : form.relatedDocuments" :limit="5" @fileInfo="getFileInfo" />
          </el-form-item>
          <el-form-item label="相关付款">
            <el-select v-model="form.contractPaymentIds" filterable multiple placeholder="请选择" style="width: 495px;">
              <el-option
                v-for="item in contractPaymentList"
                :key="item.paymentId"
                :label="item.paymentAmount"
                :value="item.paymentId"
              >
                <span style="float: left">付款金额:{{ item.paymentAmount }}</span>
                <span style="float: right; color: #8492a6; font-size: 13px">付款时间:{{ item.paymentTime }}</span>
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="备注信息" prop="remarks">
            <el-input v-model="form.remarks" :rows="3" type="textarea" style="width: 495px;" />
          </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer">
          <el-button type="text" @click="crud.cancelCU">取消</el-button>
          <el-button :loading="crud.status.cu === 2" type="primary" @click="submitCU">确认</el-button>
        </div>
      </el-dialog>
      <!--表格渲染-->
      <el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
        <el-table-column type="selection" width="55" />
        <el-table-column :show-overflow-tooltip="true" prop="contractName" label="所属合同" />
        <el-table-column :show-overflow-tooltip="true" prop="billingTime" label="开票时间" />
        <el-table-column :show-overflow-tooltip="true" prop="invoiceType" label="发票类型">
          <template slot-scope="scope">
            {{ dict.label[invoiceType][scope.row.invoiceType] }}
          </template>
        </el-table-column>
        <el-table-column :show-overflow-tooltip="true" prop="beforeTaxAmount" label="税前金额">
          <template slot-scope="scope">
            {{ crud.toMoney(scope.row.beforeTaxAmount) }}
          </template>
        </el-table-column>
        <el-table-column :show-overflow-tooltip="true" prop="taxRate" label="税率">
          <template slot-scope="scope">
            {{ scope.row.taxRate }}%
          </template>
        </el-table-column>
        <el-table-column :show-overflow-tooltip="true" prop="taxAmount" label="税额">
          <template slot-scope="scope">
            {{ crud.toMoney(scope.row.taxAmount) }}
          </template>
        </el-table-column>
        <el-table-column :show-overflow-tooltip="true" prop="afterTaxAmount" label="税后金额">
          <template slot-scope="scope">
            {{ crud.toMoney(scope.row.afterTaxAmount) }}
          </template>
        </el-table-column>
        <el-table-column :show-overflow-tooltip="true" prop="remarks" label="备注信息" />
        <el-table-column v-if="checkPer(['admin','contractInvoice:edit','contractInvoice:del'])" label="操作" width="150px" align="center">
          <template slot-scope="scope">
            <udOperation
              :data="scope.row"
              :permission="permission"
            />
          </template>
        </el-table-column>
      </el-table>
      <!--分页组件-->
      <pagination />
    </div>
  </div>
</template>
<script>
import crudContractInvoice from '@/api/contract/contractInvoice'
import CRUD, { presenter, header, form, crud } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination'
import moneyInput from '../../assembly/moneyInput/index.vue'
import fileUpload from '../../assembly/fileUpload/index.vue'
import constant from '../../../utils/constant'
import crudContract from '@/api/contract/contract'
import crudContractPayment from '@/api/contract/contractPayment'
const defaultForm = { invoiceId: null, contractId: null, billingTime: null, invoiceType: null, beforeTaxAmount: null, taxRate: null, taxAmount: null, afterTaxAmount: null, relatedDocuments: null, remarks: null, contractPaymentIds: [], createBy: null, updateBy: null, createTime: null, updateTime: null }
export default {
  name: 'ContractInvoice',
  components: { pagination, crudOperation, rrOperation, udOperation, moneyInput, fileUpload },
  mixins: [presenter(), header(), form(defaultForm), crud()],
  dicts: [constant.INVOICE_TYPE],
  cruds() {
    return CRUD({ title: '合同发票', url: 'api/contractInvoice', idField: 'invoiceId', sort: 'invoiceId,desc', crudMethod: { ...crudContractInvoice }})
  },
  data() {
    // 税前金额校验规则
    var validateBeforeTaxAmount = (rule, value, callback) => {
      if (value !== null) {
        if (isNaN(Number(value))) {
          callback(new Error('请输入数字值'))
        } else {
          if (value < 0 || value > 1000000000) {
            callback(new Error('税前金额不能超过10亿'))
          } else {
            callback()
          }
        }
      } else {
        callback(new Error('税前金额不能为空'))
      }
    }
    // 税率校验规则
    var validateTaxRate = (rule, value, callback) => {
      if (value !== null) {
        if (isNaN(Number(value))) {
          callback(new Error('请输入数字值'))
        } else {
          if (value < 0 || value > 100) {
            callback(new Error('税率不能超过100%'))
          } else {
            callback()
          }
        }
      } else {
        callback()
      }
    }
    return {
      permission: {
        add: ['admin', 'contractInvoice:add'],
        edit: ['admin', 'contractInvoice:edit'],
        del: ['admin', 'contractInvoice:del'],
        download: ['admin', 'contractInvoice:download']
      },
      rules: {
        contractId: [
          { required: true, message: '请选择所属合同', trigger: 'change' }
        ],
        billingTime: [
          { required: true, message: '请选择开票时间', trigger: 'change' }
        ],
        invoiceType: [
          { required: true, message: '请选择发票类型', trigger: 'change' }
        ],
        beforeTaxAmount: [
          { required: true, validator: validateBeforeTaxAmount, trigger: 'blur' }
        ],
        taxRate: [
          { validator: validateTaxRate, trigger: 'blur' }
        ]
      },
      queryTypeOptions: [
        { key: 'contractId', display_name: '所属合同' },
        { key: 'invoiceType', display_name: '发票类型' }
      ],
      // 字典:发票类型
      invoiceType: constant.INVOICE_TYPE,
      // 随机数
      random: 0,
      randomAR: 0,
      // 合同数据
      contractList: [],
      // 付款数据
      contractPaymentList: []
    }
  },
  methods: {
    // 钩子:在获取表格数据之前执行,false 则代表不获取数据
    [CRUD.HOOK.beforeRefresh]() {
      const that = this
      // 获取合同数据
      that.getContractList()
      // 检索条件赋值
      if (that.$route.query.contractId != null && that.crud.query.contractId === undefined) {
        that.$set(that.crud.query, 'contractId', Number(that.$route.query.contractId))
      }
      return true
    },
    // 获取合同数据
    getContractList() {
      const that = this
      // 获取合同数据
      crudContract.getAll().then(res => {
        // 获取合同数据
        that.contractList = res
      })
    },
    // 钩子:开始 "新建/编辑" - 之前
    [CRUD.HOOK.beforeToCU]() {
      const that = this
      // 随机数
      that.random = Math.random()
      that.randomAR = Math.random()
    },
    // 钩子:新建 - 之前
    [CRUD.HOOK.beforeToAdd]() {
      const that = this
      // 判断检索条件
      if (that.crud.query.contractId !== undefined) {
        // 表单赋值
        that.$set(that.crud.form, 'contractId', Number(that.crud.query.contractId))
        // 所属合同变更
        that.contractIdChange()
      }
    },
    // 钩子:编辑 - 之前
    [CRUD.HOOK.beforeToEdit]() {
      const that = this
      // 获取付款数据
      that.getContractPayment()
    },
    // 所属合同变更
    contractIdChange() {
      const that = this
      // 相关付款
      that.crud.form.contractPaymentIds = []
      // 获取付款数据
      that.contractPaymentList = []
      // 判断所属合同是否为空
      if (that.crud.form.contractId != null && that.crud.form.contractId !== '') {
        // 获取付款数据
        that.getContractPayment()
      }
    },
    // 获取付款数据
    getContractPayment() {
      const that = this
      // 获取付款数据
      crudContractPayment.getAll({ contractId: that.crud.form.contractId }).then(res => {
        // 获取付款数据
        that.contractPaymentList = res
      })
    },
    // 税前金额或税率变更
    amountOrRateChange() {
      const that = this
      // 判断税前金额和税率是否为空
      if (that.crud.form.beforeTaxAmount !== null && that.crud.form.beforeTaxAmount !== '' && that.crud.form.taxRate !== null && that.crud.form.taxRate !== '') {
        // 税额
        that.crud.form.taxAmount = that.crud.form.beforeTaxAmount * (that.crud.form.taxRate / 100)
        // 税后金额
        that.crud.form.afterTaxAmount = that.crud.form.beforeTaxAmount + that.crud.form.beforeTaxAmount * (that.crud.form.taxRate / 100)
        // 随机数
        that.randomAR = Math.random()
      }
    },
    // 表单提交
    submitCU() {
      const that = this
      // 通过“that.$refs.fileUpload”找到子页面,“submit”是子页面的方法。
      that.$refs.fileUpload.submit()
    },
    // 获取文件信息
    getFileInfo(info) {
      const that = this
      // 判断税率是否为空
      if (that.crud.form.taxRate == null || that.crud.form.taxRate === '') {
        // 税率
        that.crud.form.taxRate = 0
      }
      // 判断税额是否为空
      if (that.crud.form.taxAmount == null || that.crud.form.taxAmount === '') {
        // 税额
        that.crud.form.taxAmount = 0
      }
      // 判断税后金额是否为空
      if (that.crud.form.afterTaxAmount == null || that.crud.form.afterTaxAmount === '') {
        // 税后金额
        that.crud.form.afterTaxAmount = that.crud.form.beforeTaxAmount
      }
      // 判断返回数据
      if (info.length === 0) {
        // 表单文件路径赋值
        that.crud.form.relatedDocuments = null
        // 表单提交
        that.crud.submitCU()
        // 终止
        return
      }
      // 循环返回数据
      for (let i = 0; i < info.length; i++) {
        // 判断循环下标
        if (i === 0) {
          // 表单文件路径赋值
          that.crud.form.relatedDocuments = info[i].response == null || info[i].response === '' ? info[i].url.substring(info[i].url.indexOf('/file/'), info[i].url.length) : '/file/' + info[i].response.type + '/' + info[i].response.realName
        } else {
          // 表单文件路径赋值
          that.crud.form.relatedDocuments += info[i].response == null || info[i].response === '' ? ',' + info[i].url.substring(info[i].url.indexOf('/file/'), info[i].url.length) : ',/file/' + info[i].response.type + '/' + info[i].response.realName
        }
        // 判断循环是否结束
        if (i === info.length - 1) {
          // 表单提交
          that.crud.submitCU()
        }
      }
    }
  }
}
</script>
<style scoped>
</style>
eladmin-web-master/src/views/contract/contractPayment/index.vue
New file
@@ -0,0 +1,348 @@
<template>
  <div class="app-container">
    <!--工具栏-->
    <div class="head-container">
      <div v-if="crud.props.searchToggle">
        <!-- 搜索 -->
        <el-select v-model="query.contractId" filterable clearable placeholder="所属合同" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery">
          <el-option
            v-for="item in contractList"
            :key="item.contractId"
            :label="item.contractNumber + ' - ' + item.contractName"
            :value="item.contractId"
          />
        </el-select>
        <el-select v-model="query.fundType" filterable clearable placeholder="款项类型" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery">
          <el-option
            v-for="item in dict[fundType]"
            :key="item.id"
            :label="item.label"
            :value="item.value"
          />
        </el-select>
        <rrOperation :crud="crud" />
      </div>
      <!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
      <crudOperation :permission="permission" />
      <!--表单组件-->
      <el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="630px">
        <el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="80px">
          <el-form-item label="所属合同" prop="contractId">
            <el-select v-model="form.contractId" filterable clearable placeholder="请选择" style="width: 495px;" @change="contractIdChange">
              <el-option
                v-for="item in contractList"
                :key="item.contractId"
                :label="item.contractNumber + ' - ' + item.contractName"
                :value="item.contractId"
              />
            </el-select>
          </el-form-item>
          <el-form-item label="付款时间" prop="paymentTime">
            <el-date-picker v-model="form.paymentTime" type="datetime" style="width: 200px;" />
          </el-form-item>
          <el-form-item label="款项类型" prop="fundType">
            <el-select v-model="form.fundType" filterable placeholder="请选择" style="width: 200px;">
              <el-option
                v-for="item in dict[fundType]"
                :key="item.id"
                :label="item.label"
                :value="item.value"
              />
            </el-select>
          </el-form-item>
          <el-form-item label="付款金额" prop="paymentAmount">
            <money-input :key="random" v-model="form.paymentAmount" :width="200" />
          </el-form-item>
          <span v-if="form.fundType == fundContract">
            <el-divider>合同费款项所属</el-divider>
            <el-form-item label="所属内容" prop="fundBelong">
              <el-input v-model="form.fundBelong" style="width: 495px;" />
            </el-form-item>
          </span>
          <span v-if="form.fundType == fundService">
            <el-divider>服务费款项所属</el-divider>
            <el-form-item label="所属年度" prop="fundBelongYear">
              <el-input v-model="form.fundBelongYear" style="width: 200px;" @change="changeFundBelongYear" />
            </el-form-item>
            <el-form-item label="">
              <span style="width: 200px;" />
            </el-form-item>
            <el-form-item label="开始日期" prop="fundBelongStart">
              <el-date-picker v-model="form.fundBelongStart" type="date" style="width: 200px;" disabled />
            </el-form-item>
            <el-form-item label="结束日期" prop="fundBelongEnd">
              <el-date-picker v-model="form.fundBelongEnd" type="date" style="width: 200px;" disabled />
            </el-form-item>
          </span>
          <el-form-item label="相关发票">
            <el-select v-model="form.contractInvoiceIds" filterable multiple placeholder="请选择" style="width: 495px;">
              <el-option
                v-for="item in contractInvoiceList"
                :key="item.invoiceId"
                :label="item.afterTaxAmount"
                :value="item.invoiceId"
              >
                <span style="float: left">开票金额:{{ item.afterTaxAmount }}</span>
                <span style="float: right; color: #8492a6; font-size: 13px">开票时间:{{ item.billingTime }}</span>
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="备注信息" prop="remarks">
            <el-input v-model="form.remarks" :rows="3" type="textarea" style="width: 495px;" />
          </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer">
          <el-button type="text" @click="crud.cancelCU">取消</el-button>
          <el-button :loading="crud.status.cu === 2" type="primary" @click="submitCU">确认</el-button>
        </div>
      </el-dialog>
      <!--表格渲染-->
      <el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
        <el-table-column type="selection" width="55" />
        <el-table-column :show-overflow-tooltip="true" prop="contractName" label="所属合同" />
        <el-table-column :show-overflow-tooltip="true" prop="paymentTime" label="付款时间" />
        <el-table-column :show-overflow-tooltip="true" prop="fundType" label="款项类型">
          <template slot-scope="scope">
            {{ dict.label[fundType][scope.row.fundType] }}
          </template>
        </el-table-column>
        <el-table-column :show-overflow-tooltip="true" prop="paymentAmount" label="付款金额">
          <template slot-scope="scope">
            {{ crud.toMoney(scope.row.paymentAmount) }}
          </template>
        </el-table-column>
        <el-table-column :show-overflow-tooltip="true" prop="fundBelong" label="款项所属">
          <template slot-scope="scope">
            <span v-if="scope.row.fundBelong != null">
              {{ scope.row.fundBelong }}
            </span>
            <span v-if="scope.row.fundBelongStart != null && scope.row.fundBelongEnd != null">
              {{ scope.row.fundBelongStart.substring(0,10) }} 至 {{ scope.row.fundBelongEnd.substring(0,10) }} 服务费
            </span>
          </template>
        </el-table-column>
        <el-table-column :show-overflow-tooltip="true" prop="remarks" label="备注信息" />
        <el-table-column v-if="checkPer(['admin','contractPayment:edit','contractPayment:del'])" label="操作" width="150px" align="center">
          <template slot-scope="scope">
            <udOperation
              :data="scope.row"
              :permission="permission"
            />
          </template>
        </el-table-column>
      </el-table>
      <!--分页组件-->
      <pagination />
    </div>
  </div>
</template>
<script>
import crudContractPayment from '@/api/contract/contractPayment'
import CRUD, { presenter, header, form, crud } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination'
import moneyInput from '../../assembly/moneyInput/index.vue'
import constant from '../../../utils/constant'
import crudContract from '@/api/contract/contract'
import crudContractInvoice from '@/api/contract/contractInvoice'
const defaultForm = { paymentId: null, contractId: null, paymentTime: null, fundType: null, paymentAmount: null, fundBelong: null, fundBelongYear: null, fundBelongStart: null, fundBelongEnd: null, remarks: null, contractInvoiceIds: [], createBy: null, updateBy: null, createTime: null, updateTime: null }
export default {
  name: 'ContractPayment',
  components: { pagination, crudOperation, rrOperation, udOperation, moneyInput },
  mixins: [presenter(), header(), form(defaultForm), crud()],
  dicts: [constant.FUND_TYPE],
  cruds() {
    return CRUD({ title: '合同付款', url: 'api/contractPayment', idField: 'paymentId', sort: 'paymentId,desc', crudMethod: { ...crudContractPayment }})
  },
  data() {
    // 付款金额校验规则
    var validatePaymentAmount = (rule, value, callback) => {
      if (value !== null) {
        if (isNaN(Number(value))) {
          callback(new Error('请输入数字值'))
        } else {
          if (value < 0 || value > 1000000000) {
            callback(new Error('付款金额不能超过10亿'))
          } else {
            callback()
          }
        }
      } else {
        callback(new Error('付款金额不能为空'))
      }
    }
    return {
      permission: {
        add: ['admin', 'contractPayment:add'],
        edit: ['admin', 'contractPayment:edit'],
        del: ['admin', 'contractPayment:del'],
        download: ['admin', 'contractPayment:download']
      },
      rules: {
        contractId: [
          { required: true, message: '请选择所属合同', trigger: 'change' }
        ],
        paymentTime: [
          { required: true, message: '请选择付款时间', trigger: 'change' }
        ],
        fundType: [
          { required: true, message: '请选择款项类型', trigger: 'change' }
        ],
        paymentAmount: [
          { required: true, validator: validatePaymentAmount, trigger: 'blur' }
        ],
        fundBelong: [
          { min: 2, max: 100, message: '长度在 2 到 100 个字符', trigger: 'blur' }
        ],
        fundBelongYear: [
          { required: true, message: '请输入所属年度', trigger: 'blur' }
        ],
        fundBelongStart: [
          { required: true, message: '请选择款项开始日期', trigger: 'change' }
        ],
        fundBelongEnd: [
          { required: true, message: '请选择款项结束日期', trigger: 'change' }
        ]
      },
      queryTypeOptions: [
        { key: 'contractId', display_name: '所属合同' },
        { key: 'fundType', display_name: '款项类型' }
      ],
      // 字典:款项类型
      fundType: constant.FUND_TYPE,
      // 字典:款项类型-合同费
      fundContract: constant.FUND_CONTRACT,
      // 字典:款项类型-服务费
      fundService: constant.FUND_SERVICE,
      // 随机数
      random: 0,
      // 合同数据
      contractList: [],
      // 发票数据
      contractInvoiceList: [],
      // 当前合同信息
      currentContract: {}
    }
  },
  methods: {
    // 钩子:在获取表格数据之前执行,false 则代表不获取数据
    [CRUD.HOOK.beforeRefresh]() {
      // 获取合同数据
      this.getContractList()
      // 检索条件赋值
      if (this.$route.query.contractId != null && this.crud.query.contractId === undefined) {
        this.$set(this.crud.query, 'contractId', Number(this.$route.query.contractId))
      }
      return true
    },
    // 获取合同数据
    getContractList() {
      const that = this
      // 获取合同数据
      crudContract.getAll().then(res => {
        // 获取合同数据
        that.contractList = res
        // 判断是否传参进入
        if (that.$route.query.contractId != null) {
          // 循环合同数据
          for (let i = 0; i < res.length; i++) {
            if (res[i].contractId === Number(that.$route.query.contractId)) {
              // 当前合同信息
              that.currentContract = res[i]
              // 当前合同信息 - 服务结束日期
              that.currentContract.serviceEndDate = new Date(res[i].serviceStartsDate).getTime() - 24 * 60 * 60 * 1000
            }
          }
        }
      })
    },
    // 钩子:开始 "新建/编辑" - 之前
    [CRUD.HOOK.beforeToCU]() {
      const that = this
      // 随机数
      that.random = Math.random()
      // 表单合同所属年份
      if (that.crud.form.fundBelongStart != null) {
        that.crud.form.fundBelongYear = that.crud.form.fundBelongStart.substring(0, 4)
      }
    },
    // 钩子:新建 - 之前
    [CRUD.HOOK.beforeToAdd]() {
      const that = this
      // 判断检索条件
      if (that.crud.query.contractId !== undefined) {
        // 表单赋值
        that.$set(that.crud.form, 'contractId', Number(that.crud.query.contractId))
        // 所属合同变更
        that.contractIdChange()
      }
    },
    // 钩子:编辑 - 之前
    [CRUD.HOOK.beforeToEdit]() {
      const that = this
      // 获取发票数据
      that.getContractInvoice()
    },
    // 所属合同变更
    contractIdChange() {
      const that = this
      // 相关发票
      that.crud.form.contractInvoiceIds = []
      // 获取发票数据
      that.contractInvoiceList = []
      // 判断所属合同是否为空
      if (that.crud.form.contractId != null && that.crud.form.contractId !== '') {
        // 获取发票数据
        that.getContractInvoice()
      }
    },
    // 获取发票数据
    getContractInvoice() {
      const that = this
      // 获取发票数据
      crudContractInvoice.getAll({ contractId: that.crud.form.contractId }).then(res => {
        // 获取发票数据
        that.contractInvoiceList = res
      })
    },
    // 表单提交
    submitCU() {
      const that = this
      // 判断款项类型
      if (that.crud.form.fundType === that.fundContract) {
        // 款项所属年度
        that.crud.form.fundBelongYear = null
        // 款项开始日期
        that.crud.form.fundBelongStart = null
        // 款项结束日期
        that.crud.form.fundBelongEnd = null
      } else if (that.crud.form.fundType === that.fundService) {
        // 款项所属
        that.crud.form.fundBelong = null
      } else {
        // 暂无
      }
      // 表单提交
      that.crud.submitCU()
    },
    // 所属年度变更
    changeFundBelongYear() {
      const that = this
      // 款项开始日期
      that.crud.form.fundBelongStart = that.crud.form.fundBelongYear + that.crud.toDate(that.currentContract.serviceStartsDate).substring(4, 10)
      // 款项结束日期
      that.crud.form.fundBelongEnd = that.crud.toDate(that.currentContract.serviceEndDate).substring(4, 10) === '-12-31'
        ? Number(that.crud.form.fundBelongYear) + that.crud.toDate(that.currentContract.serviceEndDate).substring(4, 10)
        : (Number(that.crud.form.fundBelongYear) + 1) + that.crud.toDate(that.currentContract.serviceEndDate).substring(4, 10)
    }
  }
}
</script>
<style scoped>
</style>
eladmin-web-master/src/views/contract/contractSecond/index.vue
New file
@@ -0,0 +1,203 @@
<template>
  <div class="app-container">
    <!--工具栏-->
    <div class="head-container">
      <div v-if="crud.props.searchToggle">
        <!-- 搜索 -->
        <el-input v-model="query.secondName" clearable placeholder="乙方" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
        <rrOperation :crud="crud" />
      </div>
      <!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
      <crudOperation :permission="permission" />
      <!--表单组件-->
      <el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="630px">
        <el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="80px">
          <el-form-item label="乙方" prop="secondName">
            <el-input v-model="form.secondName" style="width: 495px;" />
          </el-form-item>
          <el-form-item label="联系人" prop="secondPerson">
            <el-input v-model="form.secondPerson" style="width: 200px;" />
          </el-form-item>
          <el-form-item label="联系电话" prop="secondPhone">
            <el-input v-model="form.secondPhone" style="width: 200px;" />
          </el-form-item>
          <el-form-item label="邮箱" prop="secondEmail">
            <el-input v-model="form.secondEmail" style="width: 200px;" />
          </el-form-item>
          <el-form-item label="传真" prop="secondFax">
            <el-input v-model="form.secondFax" style="width: 200px;" />
          </el-form-item>
          <el-form-item label="所在地区" prop="secondArea">
            <el-cascader
              v-model="selectedAreaOptions"
              size="large"
              :options="areaOptions"
              style="width: 495px;"
              @change="areaChange"
            />
          </el-form-item>
          <el-form-item label="详细地址" prop="secondAddress">
            <el-input v-model="form.secondAddress" :rows="3" type="textarea" style="width: 495px;" />
          </el-form-item>
          <el-form-item label="备注信息" prop="remarks">
            <el-input v-model="form.remarks" :rows="3" type="textarea" style="width: 495px;" />
          </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer">
          <el-button type="text" @click="crud.cancelCU">取消</el-button>
          <el-button :loading="crud.status.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
        </div>
      </el-dialog>
      <!--表格渲染-->
      <el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
        <el-table-column type="selection" width="55" />
        <el-table-column :show-overflow-tooltip="true" prop="secondName" label="乙方" />
        <el-table-column :show-overflow-tooltip="true" prop="secondPerson" label="联系人" />
        <el-table-column :show-overflow-tooltip="true" prop="secondPhone" label="联系电话" />
        <el-table-column :show-overflow-tooltip="true" prop="secondEmail" label="邮件" />
        <el-table-column :show-overflow-tooltip="true" prop="secondFax" label="传真" />
        <el-table-column :show-overflow-tooltip="true" prop="secondArea" label="所在地区" />
        <el-table-column :show-overflow-tooltip="true" prop="secondAddress" label="详细地址" />
        <el-table-column :show-overflow-tooltip="true" prop="remarks" label="备注信息" />
        <el-table-column v-if="checkPer(['admin','contractSecond:edit','contractSecond:del'])" label="操作" width="150px" align="center">
          <template slot-scope="scope">
            <udOperation
              :data="scope.row"
              :permission="permission"
            />
          </template>
        </el-table-column>
      </el-table>
      <!--分页组件-->
      <pagination />
    </div>
  </div>
</template>
<script>
import crudContractSecond from '@/api/contract/contractSecond'
import CRUD, { presenter, header, form, crud } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination'
import { regionData, CodeToText } from 'element-china-area-data'
const defaultForm = { secondId: null, secondName: null, secondPerson: null, secondPhone: null, secondEmail: null, secondFax: null, secondAreaCode: null, secondArea: null, secondAddress: null, remarks: null, createBy: null, updateBy: null, createTime: null, updateTime: null }
export default {
  name: 'ContractSecond',
  components: { pagination, crudOperation, rrOperation, udOperation },
  mixins: [presenter(), header(), form(defaultForm), crud()],
  cruds() {
    return CRUD({ title: '合同乙方', url: 'api/contractSecond', idField: 'secondId', sort: 'secondId,desc', crudMethod: { ...crudContractSecond }})
  },
  data() {
    // 联系电话验证
    var validateSecondPhone = (rule, value, callback) => {
      if (value) {
        const reg = /^((0\d{2,3}-\d{7,8})|(1[34578]\d{9}))$/
        if (!reg.test(value)) {
          callback(new Error('请输入正确的手机号或者座机号格式'))
        }
        callback()
      } else {
        callback(new Error('请输入联系电话'))
      }
    }
    // 邮箱验证
    var validateSecondEmail = (rule, value, callback) => {
      if (value) {
        const reg = /^([a-zA-Z0-9]+[-_\.]?)+@[a-zA-Z0-9]+\.[a-z]+$/
        if (!reg.test(value)) {
          callback(new Error('请输入正确的邮箱格式'))
        }
        callback()
      } else {
        callback()
      }
    }
    // 传真验证
    var validateSecondFax = (rule, value, callback) => {
      if (value) {
        const reg = /^(\d{3,4}-)?\d{7,8}$/
        if (!reg.test(value)) {
          callback(new Error('请输入正确的传真格式'))
        }
        callback()
      } else {
        callback()
      }
    }
    return {
      permission: {
        add: ['admin', 'contractSecond:add'],
        edit: ['admin', 'contractSecond:edit'],
        del: ['admin', 'contractSecond:del'],
        download: ['admin', 'contractSecond:download']
      },
      rules: {
        secondName: [
          { required: true, message: '请输入乙方', trigger: 'blur' },
          { min: 2, max: 100, message: '长度在 2 到 100 个字符', trigger: 'blur' }
        ],
        secondPerson: [
          { required: true, message: '请输入联系人', trigger: 'blur' },
          { min: 2, max: 10, message: '长度在 2 到 10 个字符', trigger: 'blur' }
        ],
        secondPhone: [
          { required: true, validator: validateSecondPhone, trigger: 'blur' }
        ],
        secondEmail: [
          { validator: validateSecondEmail, trigger: 'blur' }
        ],
        secondFax: [
          { validator: validateSecondFax, trigger: 'blur' }
        ],
        secondArea: [
          { required: true, message: '请选择所在地区', trigger: 'blur' }
        ],
        secondAddress: [
          { required: true, message: '请输入详细地址', trigger: 'blur' },
          { min: 2, max: 100, message: '长度在 2 到 100 个字符', trigger: 'blur' }
        ]
      },
      queryTypeOptions: [
        { key: 'secondName', display_name: '乙方' }
      ],
      // 所属地区数据
      areaOptions: regionData,
      // 选中地区数据
      selectedAreaOptions: []
    }
  },
  methods: {
    // 钩子:在获取表格数据之前执行,false 则代表不获取数据
    [CRUD.HOOK.beforeRefresh]() {
      return true
    },
    // 钩子:开始 "新建/编辑" - 之前
    [CRUD.HOOK.beforeToCU]() {
      const that = this
      // 选中地区数据置空
      that.selectedAreaOptions = []
      // 判断所在地区编码是否为空
      if (that.crud.form.secondAreaCode !== null && that.crud.form.secondAreaCode !== '') {
        // 选中地区数据赋值
        that.selectedAreaOptions = that.crud.form.secondAreaCode.split('/')
      }
    },
    // 地区选择触发
    areaChange(arr) {
      const that = this
      // 所在地区编码赋值
      that.crud.form.secondAreaCode = arr[0] + '/' + arr[1] + '/' + arr[2]
      // 所在地区赋值
      that.crud.form.secondArea = CodeToText[arr[0]] + '/' + CodeToText[arr[1]] + '/' + CodeToText[arr[2]]
    }
  }
}
</script>
<style scoped>
</style>