Przeglądaj źródła

应收应付、利润总账调整

sunhz 3 lat temu
rodzic
commit
39d5fa19cf

+ 8 - 2
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warehouse/reportManagement/ProfitController.java

@@ -8,6 +8,7 @@ import com.ruoyi.common.core.page.TableDataInfo;
 import com.ruoyi.common.enums.BusinessType;
 import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.finance.domain.TWareHouseFees;
+import com.ruoyi.finance.domain.excel.ProfitGeneralLedgerExcel;
 import com.ruoyi.finance.service.ITFeeService;
 import com.ruoyi.reportManagement.excel.Profit;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -51,8 +52,13 @@ public class ProfitController extends BaseController {
     @DataScope(deptAlias = "d", userAlias = "u")
     @GetMapping("/export")
     public AjaxResult export(TWareHouseFees tWareHouseFees) throws Exception {
-        List<Profit> list = tFeeService.profitExport(tWareHouseFees);
-        ExcelUtil<Profit> util = new ExcelUtil<Profit>(Profit.class);
+        if (tWareHouseFees.getGroupBy() == 0) {
+            List<Profit> list = tFeeService.profitExport(tWareHouseFees);
+            ExcelUtil<Profit> util = new ExcelUtil<>(Profit.class);
+            return util.exportExcel(list, "利润总账");
+        }
+        List<ProfitGeneralLedgerExcel> list = tFeeService.profitCustomExport(tWareHouseFees);
+        ExcelUtil<ProfitGeneralLedgerExcel> util = new ExcelUtil<>(ProfitGeneralLedgerExcel.class);
         return util.exportExcel(list, "利润总账");
     }
 

+ 11 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/finance/domain/TWareHouseFees.java

@@ -96,6 +96,9 @@ public class TWareHouseFees extends BaseEntity {
      * 查询时间区间 审核日期
      */
     private List<String> timeExamine;
+
+    private Integer groupBy;
+
     //业务类型 1代表凯和
     private Integer fTypeid;
     //系统类型 1 仓储 2 车队 3 凯和
@@ -239,6 +242,14 @@ public class TWareHouseFees extends BaseEntity {
         this.timeExamine = timeExamine;
     }
 
+    public Integer getGroupBy() {
+        return groupBy;
+    }
+
+    public void setGroupBy(Integer groupBy) {
+        this.groupBy = groupBy;
+    }
+
 
     /**
      * 查询时间区间 对账日期

+ 6 - 3
ruoyi-warehouse/src/main/java/com/ruoyi/finance/domain/excel/GeneralLedgerExcel.java

@@ -13,13 +13,16 @@ public class GeneralLedgerExcel implements Serializable {
     @Excel(name = "结算单位")
     private String fFeesName;
 
-    @Excel(name = "应付金额")
+    @Excel(name = "年月")
+    private String reviewDate;
+
+    @Excel(name = "金额")
     private BigDecimal fAmount;
 
-    @Excel(name = "实付金额")
+    @Excel(name = "结算金额")
     private BigDecimal fStlamount;
 
-    @Excel(name = "未付金额")
+    @Excel(name = "额")
     private BigDecimal nnfinished;
 
 }

+ 27 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/finance/domain/excel/ProfitGeneralLedgerExcel.java

@@ -0,0 +1,27 @@
+package com.ruoyi.finance.domain.excel;
+
+import com.ruoyi.common.annotation.Excel;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+@Data
+public class ProfitGeneralLedgerExcel implements Serializable {
+
+    @Excel(name = "客户")
+    private String fName;
+
+    @Excel(name = "年月")
+    private String reviewDate;
+
+    @Excel(name = "应付金额")
+    private Double fAmount;
+
+    @Excel(name = "实付金额")
+    private Double fStlamount;
+
+    @Excel(name = "未付金额")
+    private Double nnfinished;
+
+}

+ 2 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/finance/domain/vo/FeeVO.java

@@ -52,4 +52,6 @@ public class FeeVO extends TFee {
     // 应结总金额
     private BigDecimal nnfinished;
 
+    private String reviewDate;
+
 }

+ 2 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/finance/mapper/TFeeMapper.java

@@ -120,6 +120,8 @@ public interface TFeeMapper {
 
     public List<Map<String, Object>> warehouseBillsFeesProfitList(TWareHouseFees tWareHouseFees);
 
+    public List<Map<String, Object>> warehouseBillsFeesCustomProfitList(TWareHouseFees tWareHouseFees);
+
     /**
      * 查询详情主表列表
      * @param fid

+ 3 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/finance/service/ITFeeService.java

@@ -7,6 +7,7 @@ import com.ruoyi.finance.domain.TWareHouseFees;
 import com.ruoyi.finance.domain.dto.FeeDTO;
 import com.ruoyi.finance.domain.excel.GeneralLedgerDetailExcel;
 import com.ruoyi.finance.domain.excel.GeneralLedgerExcel;
+import com.ruoyi.finance.domain.excel.ProfitGeneralLedgerExcel;
 import com.ruoyi.finance.domain.vo.FeeVO;
 import com.ruoyi.finance.excel.Charge;
 import com.ruoyi.finance.excel.Contrast;
@@ -233,6 +234,8 @@ public interface ITFeeService {
 
     public List<Profit> profitExport(TWareHouseFees tWareHouseFees) throws Exception;
 
+    public List<ProfitGeneralLedgerExcel> profitCustomExport(TWareHouseFees tWareHouseFees) throws Exception;
+
     public List<Contrast> contrastExport(TFee tFee) throws Exception;
 
     public List<Payment> paymentExport(TFee tFee) throws Exception;

+ 13 - 3
ruoyi-warehouse/src/main/java/com/ruoyi/finance/service/impl/TFeeServiceImpl.java

@@ -24,6 +24,7 @@ import com.ruoyi.finance.domain.TWareHouseFees;
 import com.ruoyi.finance.domain.dto.FeeDTO;
 import com.ruoyi.finance.domain.excel.GeneralLedgerDetailExcel;
 import com.ruoyi.finance.domain.excel.GeneralLedgerExcel;
+import com.ruoyi.finance.domain.excel.ProfitGeneralLedgerExcel;
 import com.ruoyi.finance.domain.vo.FeeVO;
 import com.ruoyi.finance.excel.Charge;
 import com.ruoyi.finance.excel.Contrast;
@@ -694,7 +695,10 @@ public class TFeeServiceImpl implements ITFeeService {
 
     @Override
     public List<Map<String, Object>> warehouseBillsFeesProfitList(TWareHouseFees tWareHouseFees) {
-        return tFeeMapper.warehouseBillsFeesProfitList(tWareHouseFees);
+        if (tWareHouseFees.getGroupBy() == 0) {
+            return tFeeMapper.warehouseBillsFeesProfitList(tWareHouseFees);
+        }
+        return tFeeMapper.warehouseBillsFeesCustomProfitList(tWareHouseFees);
     }
 
     public static BigDecimal calculation1(String fTotalgross, String fGrossweightblc) {
@@ -1321,6 +1325,7 @@ public class TFeeServiceImpl implements ITFeeService {
         feeVOList.forEach(vo -> {
             GeneralLedgerExcel ledgerExcel = new GeneralLedgerExcel();
             ledgerExcel.setFAmount(vo.getFAmount());
+            ledgerExcel.setReviewDate(vo.getReviewDate());
             ledgerExcel.setFFeesName(vo.getFFeesName());
             ledgerExcel.setNnfinished(vo.getNnfinished());
             ledgerExcel.setFStlamount(vo.getFStlamount());
@@ -1332,8 +1337,13 @@ public class TFeeServiceImpl implements ITFeeService {
     @Override
     public List<Profit> profitExport(TWareHouseFees tWareHouseFees) throws Exception {
         List<Map<String, Object>> list = tFeeMapper.warehouseBillsFeesProfitList(tWareHouseFees);
-        List<Profit> list1 = ListMapToBeanUtils.castMapToBean(list, Profit.class);
-        return list1;
+        return ListMapToBeanUtils.castMapToBean(list, Profit.class);
+    }
+
+    @Override
+    public List<ProfitGeneralLedgerExcel> profitCustomExport(TWareHouseFees tWareHouseFees) throws Exception {
+        List<Map<String, Object>> list = tFeeMapper.warehouseBillsFeesCustomProfitList(tWareHouseFees);
+        return ListMapToBeanUtils.castMapToBean(list, ProfitGeneralLedgerExcel.class);
     }
 
     @Override

+ 1 - 1
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/component/impl/QueryWhgenlegServiceImpl.java

@@ -120,7 +120,7 @@ public class QueryWhgenlegServiceImpl implements QueryWhgenlegService {
         // 贸易方式
         whgenleg.setfTrademodeid(warehouseBills.getfTrademodeid());
         // 业务日期
-        whgenleg.setfBsdate(DateUtils.dateConversionMin(item.getfOriginalbilldate()));
+        whgenleg.setfBsdate(DateUtils.dateConversionMin(item.getfBsdate()));
         // 库区
         whgenleg.setfWarehouseLocationid(item.getfWarehouselocid());
     }

+ 1 - 1
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/domain/enums/WarehouseTypeEnum.java

@@ -16,7 +16,7 @@ import java.util.Objects;
 public enum WarehouseTypeEnum {
 
     // 仓储业务类型
-
+    QTZW("QTZW", "其他账务", "storageType"),
 
     KCZZ("KCZZ", "库存总帐", "storageType"),
 

+ 57 - 5
ruoyi-warehouse/src/main/resources/mapper/finance/TFeeMapper.xml

@@ -1918,6 +1918,57 @@
             w.f_mblno
         </where>
     </select>
+
+    <select id="warehouseBillsFeesCustomProfitList" resultType="java.util.Map">
+        SELECT
+            c.f_name AS fName,
+            DATE_FORMAT(w.f_review_date,'%Y-%m') AS reviewDate,
+            sum( CASE f_dc WHEN 'D' THEN f_amount ELSE 0 END ) fAmount,
+            sum( CASE f_dc WHEN 'C' THEN f_amount ELSE 0 END ) fStlamount,
+            sum( CASE f_dc WHEN 'D' THEN f_amount ELSE 0 END ) - sum( CASE f_dc WHEN 'C' THEN f_amount ELSE 0 END ) nnfinished
+        FROM
+        t_warehousebillsfees w
+        LEFT JOIN t_warehousebills t ON t.f_id = w.f_pid
+        left join sys_user u on t.create_by = u.user_name
+        left join sys_user u1 on t.f_salesman_id = u1.user_id
+        left join sys_dept d on t.f_bsdeptid = d.dept_id
+        LEFT JOIN t_corps c ON c.f_id = t.f_corpid
+        LEFT JOIN t_corps c1 ON c1.f_id = w.f_corpid
+        <where>
+            <if test="fCorpid != null and fCorpid != ''">and t.f_corpid = #{fCorpid}</if>
+            <if test="fToCorpid != null and fToCorpid != ''">and w.f_corpid = #{fToCorpid}</if>
+            <if test="fSalesmanId != null and fSalesmanId != ''">and t.f_salesman_id = #{fSalesmanId}</if>
+            <if test="fMblno != null  and fMblno != ''">and w.f_mblno like concat('%', #{fMblno}, '%')</if>
+            <if test="fMarks != null and fMarks != ''">and w.f_marks like concat('%', #{fMarks}, '%')</if>
+            <if test="fProductName != null and fProductName != ''">and w.f_product_name like concat('%',#{fProductName}, '%')</if>
+            <if test='fBillstatus != null and fBillstatus != "" and fBillstatus == "0" '>and w.f_billstatus != 6</if>
+            <if test='fBillstatus != null and fBillstatus != "" and fBillstatus == "1" '>and w.f_billstatus = 6</if>
+            <if test='timeExamine != null and timeExamine[0] != null and timeExamine[0]!= ""'>
+                and DATE_FORMAT(w.f_review_date, '%Y-%m') between #{timeExamine[0]} and #{timeExamine[1]}
+            </if>
+            <if test='fReconciliation!= null and fReconciliation != "" and fReconciliation == "0" '>
+                and ifnull(w.f_amount, 0) - ifnull(w.f_stlamount, 0) != 0
+            </if>
+            <if test="fBusinessType != null  and fBusinessType != '' ">
+                and w.f_business_type in
+                <foreach collection="fBusinessType" item="id" open="(" close=")" separator=",">
+                    #{id}
+                </foreach>
+            </if>
+            <if test="fFeeid != null  and fFeeid != '' ">
+                and w.f_feeid in
+                <foreach collection="fFeeid" item="id" open="(" close=")" separator=",">
+                    #{id}
+                </foreach>
+            </if>
+            and w.f_review_date IS NOT NULL
+            ${params.dataScope}
+        </where>
+        GROUP BY
+            c.f_name,
+            reviewDate
+    </select>
+
     <select id="selectFeeList" resultType="java.util.Map">
         select
             ware.create_by AS createBy,
@@ -2696,7 +2747,7 @@
 
     <select id="selectFinancialLedgerList" resultMap="feeVOResult">
         SELECT
-            c.f_name AS f_fees_name, w.f_corpid, w.f_mblno, w.f_billstatus, w.f_review_date,
+            c.f_name AS f_fees_name, w.f_corpid, w.f_mblno, w.f_billstatus, DATE_FORMAT(w.f_review_date,'%Y-%m') AS reviewDate,
             SUM( w.f_amount ) AS f_amount, SUM( w.f_stlamount ) AS f_stlamount,
             ifnull( SUM( w.f_amount ), 0 ) - ifnull( SUM( w.f_stlamount ), 0 ) AS nnfinished
         FROM
@@ -2721,17 +2772,18 @@
             <if test="isReviewed != null and isReviewed == 1">
                 and w.f_billstatus = 6
             </if>
-            <if test="fReconciliation!= null and fReconciliation != '' and fReconciliation == '0'">
+            <if test="fReconciliation!= null and fReconciliation != '' and fReconciliation == 0">
                 and ifnull(w.f_amount, 0) - ifnull(w.f_stlamount, 0) != 0
             </if>
             <if test="timeExamine != null and timeExamine[0] != null and timeExamine[0]!= ''">
-                and w.f_review_date between #{timeExamine[0]} and #{timeExamine[1]}
+                and DATE_FORMAT(w.f_review_date, '%Y-%m') between #{timeExamine[0]} and #{timeExamine[1]}
             </if>
             ${params.dataScope}
         </where>
         GROUP BY
             w.f_corpid,
-            w.f_dc
+            w.f_dc,
+            reviewDate
     </select>
 
     <select id="selectFinancialLedgerDetails" resultMap="feeVOResult">
@@ -2758,7 +2810,7 @@
                 and w.f_billstatus = 6
             </if>
             <if test='fAuditList != null and fAuditList[0] != null'>
-                and w.f_review_date BETWEEN #{fAuditList[0]} and #{fAuditList[1]}
+                and DATE_FORMAT(w.f_review_date, '%Y-%m') BETWEEN #{fAuditList[0]} and #{fAuditList[1]}
             </if>
         GROUP BY
         w.f_id