Pārlūkot izejas kodu

修改导出bug

caizhen 4 gadi atpakaļ
vecāks
revīzija
7c28ef82f5

+ 51 - 0
lift-business-service/src/main/java/cn/com/ty/lift/business/contract/dao/entity/model/response/ContractExportDto.java

@@ -119,5 +119,56 @@ public class ContractExportDto {
      */
     private Integer paymentDays;
 
+    /**
+     * 合同来源
+     *  1 : 商保新增 ;2 : 免保转签;3 : 续签;4 : 免保
+     */
+    private String source;
+
+
+    /**
+     * 合同类型
+     * 合同类型(1 : 半包;2:大包;3:清包;4:全包;5:大修)
+     */
+    private String type;
+
+    /**
+     * 合同开始时间
+     */
+    private LocalDate starDate;
+
+    /**
+     * 合同结束时间
+     */
+    private LocalDate endDate;
+
+
+    /**
+     * 台量
+     */
+    private Integer liftNum;
+
+    /**
+     * 签约时间
+     */
+    private LocalDate givenDate;
+
+    /**
+     * 签约人
+     */
+    private String givenUser;
+
+
+    /**
+     * 未收
+     */
+    private BigDecimal NoPayMoney;
+
+
+    /**
+     * 配件条款
+     */
+    private String partsRules;
+
 
 }

+ 146 - 85
lift-business-service/src/main/resources/mapper/contract/ContractsMapper.xml

@@ -104,66 +104,98 @@
     <select id="findAllContracts"
             parameterType="cn.com.ty.lift.business.contract.dao.entity.model.request.ContractRequest"
             resultType="cn.com.ty.lift.business.contract.dao.entity.model.response.ContractExportDto">
-           select
-              <!--合同编号-->
-               c.code as contractCode,
+        select
+        <!--合同编号-->
+        c.code as contractCode,
 
-               <!--客户名称-->
-               c.given_user as memberName,
+        <!--客户名称-->
+        (select name from property_company where id=p.pp_company_id) as memberName,
 
-               <!--收款类型-->
-               case when pay.type = 1 then '维保费' else '大修费' end as payType,
+        <!--收款类型-->
+        case when pay.type = 1 then '维保费' else '大修费' end as payType,
 
-               <!--收款编号-->
-               pay.code as paycode,
+        <!--收款编号-->
+        pay.code as paycode,
 
-               <!--项目名称-->
-               p.project_name as projectName,
+        <!--项目名称-->
+        p.project_name as projectName,
 
-               <!--项目内容-->
-               CONCAT(c.lift_num,'台',case when pay.periods = '' or pay.periods is null then '1' else  pay.periods end,'期',p.start_date,'至',p.end_date) as projectContent,
+        <!--项目内容-->
+        CONCAT(c.lift_num,'台',case when pay.periods = '' or pay.periods is null then '1' else pay.periods
+        end,'期',p.start_date,'至',p.end_date) as projectContent,
 
-               <!--本期应收-->
-               pay.plan_money as nowMoney,
+        <!--本期应收-->
+        pay.plan_money as nowMoney,
 
-               <!--合同金额-->
-               c.moneys as moneys,
+        <!--合同金额-->
+        c.moneys as moneys,
 
-               <!--应收日期-->
-               pay.plan_date as planDate,
+        <!--合同来源-->
+        case c.source when 1 then '商保新增' when 2 then '免保转签' when 3 then '续签' when 4 then '免保' else '暂无',
 
-              <!--期数-->
-               pay.periods as periods,
+        <!--合同类型-->
+        case c.type when 1 then '半包' when 2 then '半包' when 3 then '清包' when 4 then '全包' when 5 then '大修' else '暂无',
 
-              <!--收款责任人-->
-               pay.collection_man as collectionMan,
+        <!--合同开始时间-->
+        c.star_date as starDate,
 
-              <!--区域-->
-              (select area_name from region where region.id=p.region_id) as regionName,
+        <!--合同结束时间-->
+        c.end_date as endDate,
 
-              <!--帐龄-->
-               pay.work_date - pay.plan_date as paymentDays,
 
-              <!--开票金额-->
-               pay.amount_invoice as amountInvoice,
+        <!--台量-->
+        c.lift_num as liftNum,
 
-              <!--开票时间-->
-              pay.billing_date as billingDate,
 
-              <!--发票类型-->
-              pay.invoice_type as invoiceType,
+        <!--金额=合同金额-->
+        <!--签约时间-->
+        c.given_date as givenDate,
 
-              <!--到账日期-->
-              pay.work_date as workDate,
+        <!--签约人-->
+        c.given_user as givenUser,
 
-             <!--实收金额-->
-              pay.work_money as workMoney
-             <!--表关联-->
-            from project p
-            LEFT JOIN
-             contracts c on c.project_id=p.id
-            left join payment pay on pay.contracts_id=c.id
-            <!--筛选条件-->
+        <!--未收-->
+        pay.plan_money - pay.work_money as NoPayMoney,
+
+        <!--配件条款-->
+        c.parts_rules as partsRules,
+
+
+        <!--应收日期-->
+        pay.plan_date as planDate,
+
+        <!--期数-->
+        pay.periods as periods,
+
+        <!--收款责任人-->
+        pay.collection_man as collectionMan,
+
+        <!--区域-->
+        (select area_name from region where region.id=p.region_id) as regionName,
+
+        <!--帐龄-->
+        pay.work_date - pay.plan_date as paymentDays,
+
+        <!--开票金额-->
+        pay.amount_invoice as amountInvoice,
+
+        <!--开票时间-->
+        pay.billing_date as billingDate,
+
+        <!--发票类型-->
+        pay.invoice_type as invoiceType,
+
+        <!--到账日期-->
+        pay.work_date as workDate,
+
+        <!--实收金额-->
+        pay.work_money as workMoney
+        <!--表关联-->
+        from project p
+        LEFT JOIN
+        contracts c on c.project_id=p.id
+        left join payment pay on pay.contracts_id=c.id
+        <!--筛选条件-->
         WHERE c.mt_company_id = #{request.mtCompanyId,jdbcType=BIGINT}
         <if test="request.contractCode!=null and request.contractCode!=''">
             AND c.code LIKE CONCAT('%',#{request.contractCode,jdbcType=VARCHAR},'%')
@@ -186,52 +218,81 @@
         <if test="request.endDate!=null and request.endDate!=''">
             AND c.end_date >=#{request.endDate}
         </if>
-</select>
+    </select>
 
 
     <select id="findAllErContracts"
             parameterType="cn.com.ty.lift.business.contract.dao.entity.model.request.ContractRequest"
             resultType="cn.com.ty.lift.business.contract.dao.entity.model.response.ContractExportDto">
-     select
-          <!--合同编号-->
-          c.code as contractCode,
-          <!--客户名称-->
-          (select attestation_name from mt_company_attestation where mt_company_attestation.mt_company_id=c.mt_company_id) as memberName,
-          <!--收款类型 默认T修理-->
-          CONCAT('T修理')as payType,
-          <!--收款编号 无-->
-          <!--项目名称-->
-          p.project_name as projectName,
-          <!--项目内容-->
-          CONCAT(p.project_name,emr.caller_fault_description) as projectContent,
-          <!--本期应收-->
-          erc.cost_money  as nowMoney,
-          <!--合同金额-->
-          c.moneys as moneys,
-          <!--应收日期-->
-          erc.cost_date as planDate,
-          <!--期数-->
-          <!--收款责任人-->
-          erc.collection_man as collectionMan,
-          <!--区域-->
-          (select area_name from region where region.id=p.region_id) as regionName,
-          <!--帐龄-->
-          erc.pay_date - erc.cost_date as paymentDays,
-          <!--开票金额-->
-          erc.invoice_money as amountInvoice,
-          <!--开票时间-->
-          erc.invoice_date as billingDate,
-          <!--发票类型-->
-          erc.invoice_type as invoiceType,
-          <!--到账时间-->
-          erc.pay_date as workDate,
-          <!--到账金额-->
-          erc.pay_money as workMoney
-          <!--表关联-->
-     from er_record_cost erc
-     LEFT JOIN emergency_repair emr on erc.er_record_id=emr.id
-     LEFT JOIN project p on emr.project_id=p.id
-     left join contracts c on c.project_id=p.id
+        select
+        <!--合同编号-->
+        c.code as contractCode,
+        <!--客户名称-->
+        (select name from property_company where id=p.pp_company_id) as memberName,
+        <!--收款类型 默认T修理-->
+        CONCAT('T修理')as payType,
+        <!--收款编号 无-->
+        <!--项目名称-->
+        p.project_name as projectName,
+        <!--项目内容-->
+        CONCAT(p.project_name,emr.caller_fault_description) as projectContent,
+        <!--本期应收-->
+        erc.cost_money as nowMoney,
+        <!--合同金额-->
+        c.moneys as moneys,
+
+        <!--合同来源-->
+        case c.source when 1 then '商保新增' when 2 then '免保转签' when 3 then '续签' when 4 then '免保' else '暂无',
+
+        <!--合同类型-->
+        case c.type when 1 then '半包' when 2 then '半包' when 3 then '清包' when 4 then '全包' when 5 then '大修' else '暂无',
+
+        <!--合同开始时间-->
+        c.star_date as starDate,
+
+        <!--合同结束时间-->
+        c.end_date as endDate,
+
+        <!--台量-->
+        c.lift_num as liftNum,
+
+        <!--金额=合同金额-->
+        <!--签约时间-->
+        c.given_date as givenDate,
+
+        <!--签约人-->
+        c.given_user as givenUser,
+
+        <!--未收-->
+        erc.cost_money - erc.pay_money as NoPayMoney,
+
+        <!--配件条款-->
+        c.parts_rules as partsRules,
+
+        <!--应收日期-->
+        erc.cost_date as planDate,
+        <!--期数-->
+        <!--收款责任人-->
+        erc.collection_man as collectionMan,
+        <!--区域-->
+        (select area_name from region where region.id=p.region_id) as regionName,
+        <!--帐龄-->
+        erc.pay_date - erc.cost_date as paymentDays,
+        <!--开票金额-->
+        erc.invoice_money as amountInvoice,
+        <!--开票时间-->
+        erc.invoice_date as billingDate,
+        <!--发票类型-->
+        erc.invoice_type as invoiceType,
+        <!--到账时间-->
+        erc.pay_date as workDate,
+        <!--到账金额-->
+        erc.pay_money as workMoney
+        <!--表关联-->
+        from er_record_cost erc
+        LEFT JOIN emergency_repair emr on erc.er_record_id=emr.id
+        LEFT JOIN project p on emr.project_id=p.id
+        left join contracts c on c.project_id=p.id
         <!--筛选条件-->
         WHERE c.mt_company_id = #{request.mtCompanyId,jdbcType=BIGINT}
         <if test="request.contractCode!=null and request.contractCode!=''">
@@ -255,5 +316,5 @@
         <if test="request.endDate!=null and request.endDate!=''">
             AND c.end_date >=#{request.endDate}
         </if>
-</select>
+    </select>
 </mapper>