Browse Source

汇款明细

yzc 11 months ago
parent
commit
d554b231c5

+ 8 - 0
hx-form/src/main/java/com/fjhx/form/controller/FinanceReportController.java

@@ -1,5 +1,8 @@
 package com.fjhx.form.controller;
 
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fjhx.form.entity.RemitDetailSelectDto;
+import com.fjhx.form.entity.RemitDetailVo;
 import com.fjhx.form.entity.SubjectBalanceBo;
 import com.fjhx.form.entity.SubjectBalanceSelectDto;
 import com.fjhx.form.service.FinanceReportService;
@@ -22,4 +25,9 @@ public class FinanceReportController {
     List<SubjectBalanceBo> subjectBalance(@RequestBody SubjectBalanceSelectDto dto) {
         return financeReportService.subjectBalance(dto);
     }
+
+    @PostMapping("/remitDetailPage")
+    Page<RemitDetailVo> getRemitDetailPage(@RequestBody RemitDetailSelectDto dto) {
+        return financeReportService.getRemitDetailPage(dto);
+    }
 }

+ 6 - 0
hx-form/src/main/java/com/fjhx/form/entity/RemitDetailSelectDto.java

@@ -0,0 +1,6 @@
+package com.fjhx.form.entity;
+
+import com.ruoyi.common.core.domain.BaseSelectDto;
+
+public class RemitDetailSelectDto extends BaseSelectDto {
+}

+ 63 - 0
hx-form/src/main/java/com/fjhx/form/entity/RemitDetailVo.java

@@ -0,0 +1,63 @@
+package com.fjhx.form.entity;
+
+import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
+import com.alibaba.excel.annotation.ExcelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+@Getter
+@Setter
+@ExcelIgnoreUnannotated
+public class RemitDetailVo {
+    @ExcelProperty("交易时间")
+    private Date transactionTime;
+    @ExcelProperty("银行卡")
+    private String accountAliasName;
+    @ExcelProperty("备注")
+    private String remark;
+    @ExcelProperty("对方科目-输入")
+    private String oppositeSubjectName1;
+    @ExcelProperty("销售组费用类别-输入")
+    private String saleGroupExpenseCategory;
+    @ExcelProperty("收入")
+    private BigDecimal incomeAmount;
+    @ExcelProperty("支出")
+    private BigDecimal expenditureAmount;
+    @ExcelProperty("余额")
+    private BigDecimal balanceAmount;
+    @ExcelProperty("供应商")
+    private String supplierName;
+    @ExcelProperty("客户简称")
+    private String customerShortName;
+    @ExcelProperty("合同单号")
+    private String contractCode;
+    @ExcelProperty("科目名称")
+    private String subjectName;
+    @ExcelProperty("核算项目1")
+    private String calculateItemType1;
+    @ExcelProperty("核算项目2")
+    private String calculateItemType2;
+    @ExcelProperty("核算项目1名称-可修改")
+    private String calculateItemName1;
+    @ExcelProperty("核算项目2名称-可修改")
+    private String calculateItemName2;
+    @ExcelProperty("对方科目")
+    private String oppositeSubjectCode;
+    @ExcelProperty("对方科目名称")
+    private String oppositeSubjectName;
+    @ExcelProperty("核算项目数据导入")
+    private String calculateItemStr;
+    @ExcelProperty("银行科目代码")
+    private String bankSubjectCode;
+    @ExcelProperty("银行科目名称")
+    private String bankSubjectName;
+    @ExcelProperty("合并科目核算项目名称")
+    private String subjectCalculateItemStr;
+    @ExcelProperty("记账凭证号")
+    private String voucherNo;
+    @ExcelProperty("订单性质")//1归属工厂、2归属业务
+    private String belongType;
+}

+ 4 - 0
hx-form/src/main/java/com/fjhx/form/mapper/FinanceReportMapper.java

@@ -1,5 +1,7 @@
 package com.fjhx.form.mapper;
 
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fjhx.form.entity.RemitDetailVo;
 import com.fjhx.form.entity.SubjectBalanceBo;
 import com.fjhx.form.entity.SubjectBalanceSelectDto;
 import com.ruoyi.common.utils.wrapper.IWrapper;
@@ -13,4 +15,6 @@ public interface FinanceReportMapper {
 
     List<SubjectBalanceBo> subjectBalance(@Param("ew") IWrapper<Object> wrapper, @Param("dto") SubjectBalanceSelectDto dto);
 
+    Page<RemitDetailVo> getRemitDetailPage(@Param("page") Page<Object> page, @Param("ew") IWrapper<Object> wrapper);
+
 }

+ 8 - 0
hx-form/src/main/java/com/fjhx/form/service/FinanceReportService.java

@@ -1,5 +1,8 @@
 package com.fjhx.form.service;
 
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fjhx.form.entity.RemitDetailSelectDto;
+import com.fjhx.form.entity.RemitDetailVo;
 import com.fjhx.form.entity.SubjectBalanceBo;
 import com.fjhx.form.entity.SubjectBalanceSelectDto;
 
@@ -7,4 +10,9 @@ import java.util.List;
 
 public interface FinanceReportService {
     List<SubjectBalanceBo> subjectBalance(SubjectBalanceSelectDto dto);
+
+    /**
+     * 汇款明细
+     */
+    Page<RemitDetailVo> getRemitDetailPage(RemitDetailSelectDto dto);
 }

+ 26 - 0
hx-form/src/main/java/com/fjhx/form/service/impl/FinanceReportServiceImpl.java

@@ -6,8 +6,11 @@ import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.core.util.StrUtil;
 import com.alibaba.fastjson2.JSONObject;
 import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.fjhx.common.constant.SourceConstant;
 import com.fjhx.common.utils.Assert;
+import com.fjhx.form.entity.RemitDetailSelectDto;
+import com.fjhx.form.entity.RemitDetailVo;
 import com.fjhx.form.entity.SubjectBalanceBo;
 import com.fjhx.form.entity.SubjectBalanceSelectDto;
 import com.fjhx.form.entity.account.po.AccountSubjectsBalance;
@@ -131,4 +134,27 @@ public class FinanceReportServiceImpl implements FinanceReportService {
         SecurityUtils.clearTenantId();
         DynamicDataSourceContextHolder.clear();
     }
+
+    @Override
+    public Page<RemitDetailVo> getRemitDetailPage(RemitDetailSelectDto dto) {
+        IWrapper<Object> wrapper = IWrapper.getWrapper();
+
+        wrapper.keyword(dto.getKeyword(),
+                new SqlField("t1.contract_codes"),
+                new SqlField("t2.subject_name"),
+                new SqlField("t1.customerShortName"),
+                new SqlField("t2.supplier_names"),
+                new SqlField("cc.voucher_no"),
+                new SqlField("arw.amount"),
+                new SqlField("am.`alias`")
+        );
+
+        //交易时间范围过滤
+        wrapper.ge("arw.transaction_time", dto.getBeginTime());
+        wrapper.le("arw.transaction_time", dto.getEndTime());
+
+        wrapper.orderByDesc("arw.transaction_time");
+        Page<RemitDetailVo> page = financeReportMapper.getRemitDetailPage(dto.getPage(), wrapper);
+        return page;
+    }
 }

+ 59 - 0
hx-form/src/main/resources/mapper/FinanceReportMapper.xml

@@ -33,4 +33,63 @@
         GROUP BY
             CONCAT( calculate_item_str )
     </select>
+    <select id="getRemitDetailPage" resultType="com.fjhx.form.entity.RemitDetailVo">
+        SELECT arw.transaction_time                 AS transactionTime,
+               am.`alias`                           AS accountAliasName,
+               t1.contract_remarks                  AS remark,
+               NULL                                 AS oppositeSubjectName1,
+               NULL                                 AS saleGroupExpenseCategory,
+               IF(arw.`status` = 10, arw.amount, 0) AS incomeAmount,
+               IF(arw.`status` = 20, arw.amount, 0) AS expenditureAmount,
+               arw.account_remainder                AS balanceAmount,
+               t2.supplier_names                    AS supplierName,
+               t1.customerShortName                 AS customerShortName,
+               t1.contract_codes                    AS contractCode,
+               t2.subject_name                      AS subjectName,
+               t2.calculate_item_type1              AS calculateItemType1,
+               t2.calculate_item_type2              AS calculateItemType2,
+               t2.calculate_item_name1              AS calculateItemName1,
+               t2.calculate_item_name2              AS calculateItemName2,
+               t2.opposite_subject_code             AS oppositeSubjectCode,
+               t2.opposite_subject_name             AS oppositeSubjectName,
+               t2.calculate_item_str                AS calculateItemStr,
+               am.jd_subject_code                   AS bankSubjectCode,
+               am.jd_subject_name                   AS bankSubjectName,
+               t2.subject_calculate_item_str        AS subjectCalculateItemStr,
+               cc.voucher_no                        AS voucherNo,
+               t1.belongType                        AS belongType
+        FROM account_running_water arw
+                 JOIN account_management am ON arw.account_management_id = am.id
+                 LEFT JOIN cost_control cc ON arw.cost_control_id = cc.id
+                 LEFT JOIN (SELECT cod.cost_control_id,
+                                   GROUP_CONCAT(DISTINCT sui.`name` )                         AS supplier_names,
+                                   GROUP_CONCAT(asj.jd_subject_code)                          AS opposite_subject_code,
+                                   GROUP_CONCAT(asj.jd_subject_name)                          AS opposite_subject_name,
+                                   GROUP_CONCAT(asj.subjects_name)                            AS subject_name,
+                                   GROUP_CONCAT(cod.calculate_item_type1)                     AS calculate_item_type1,
+                                   GROUP_CONCAT(cod.calculate_item_name1)                     AS calculate_item_name1,
+                                   GROUP_CONCAT(cod.calculate_item_type2)                     AS calculate_item_type2,
+                                   GROUP_CONCAT(cod.calculate_item_name2)                     AS calculate_item_name2,
+                                   GROUP_CONCAT(cod.calculate_item_str)                       AS calculate_item_str,
+                                   GROUP_CONCAT(asj.subjects_name, ' - ' + cod.calculate_item_name1,
+                                                IFNULL(' - ' + cod.calculate_item_name2, '')) AS subject_calculate_item_str
+                            FROM cost_control_detail cod
+                                     LEFT JOIN supplier_info sui ON cod.supplier_id = sui.id
+                                     LEFT JOIN account_subjects asj ON cod.account_subjects_id = asj.id
+                            GROUP BY cod.cost_control_id) t2 ON t2.cost_control_id = cc.id
+                 LEFT JOIN (SELECT cl.business_id,
+                                   cl.amount,
+                                   GROUP_CONCAT(c.`code`)                                             AS contract_codes,
+                                   cu.`name`                                                          AS customerName,
+                                   cu.short_name                                                      AS customerShortName,
+                                   GROUP_CONCAT(c.remark)                                             AS contract_remarks,
+                                   GROUP_CONCAT(IF(c.belong_type = 1, "归属工厂",
+                                                   IF(c.belong_type = 2, "归属业务", c.belong_type))) AS belongType
+                            FROM claim cl
+                                     JOIN claim_contract clo ON clo.claim_id = cl.id
+                                     LEFT JOIN contract c ON clo.contract_id = c.id
+                                     LEFT JOIN customer cu ON c.buy_corporation_id = cu.id
+                            GROUP BY cl.id) t1 ON t1.business_id = arw.id
+            ${ew.customSqlSegment}
+    </select>
 </mapper>