Explorar o código

仓库系统添加库存总账统计报表

阿伏兔 %!s(int64=4) %!d(string=hai) anos
pai
achega
1c4d9dc0d5

+ 14 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/fleet/orderPlan/ftmsorderbillscarsController.java

@@ -65,6 +65,20 @@ public class ftmsorderbillscarsController extends BaseController {
     }
 
     /**
+     * 查询司机状态跟踪列表
+     */
+    @GetMapping("/wechatQuery")
+    public Map<String, Object> wechatQuery(Ftmsorderbills ftmsorderbills) {
+        Map<String, Object> map = new HashMap<>();
+//        Ftmsorderbills tmsorder = ftmsorderbillscarsService.judgmentFleet(ftmsorderbills);
+        startPage();
+        List<FtmsorderbillscarsExcel> list = ftmsorderbillscarsService.selectftmsorderbillscarsMapList(ftmsorderbills);
+        map.put("dataTable", getDataTable(list));
+        map.put("buttonValue", ftmsorderbillscarsService.getButtonValue());
+        return map;
+    }
+
+    /**
      * 根据手机号查询司机的
      * 新订单、本月订单、本月历程、本月运费
      */

+ 27 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warehouse/warehouseBusiness/TWarehousebillsfeesController.java

@@ -3,9 +3,14 @@ package com.ruoyi.web.controller.warehouse.warehouseBusiness;
 import com.ruoyi.common.annotation.Log;
 import com.ruoyi.common.core.controller.BaseController;
 import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.domain.model.LoginUser;
 import com.ruoyi.common.core.page.TableDataInfo;
 import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.utils.ServletUtils;
 import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.common.utils.spring.SpringUtils;
+import com.ruoyi.finance.excel.FleetExcel;
+import com.ruoyi.framework.web.service.TokenService;
 import com.ruoyi.warehouseBusiness.domain.TWarehousebillsfees;
 import com.ruoyi.warehouseBusiness.service.ITWarehousebillsfeesService;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -50,6 +55,28 @@ public class TWarehousebillsfeesController extends BaseController {
     }
 
     /**
+     * 查询仓库费用明细列表
+     */
+    @GetMapping("/financialStatistics")
+    public TableDataInfo financialStatistics(TWarehousebillsfees tWarehousebillsfees) {
+        LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest());
+        tWarehousebillsfees.setCreateBy(loginUser.getUser().getNickName());
+        startPage();
+        List<FleetExcel> list = tWarehousebillsfeesService.selectFleetExcelList(tWarehousebillsfees);
+        return getDataTable(list);
+    }
+
+    @GetMapping("/feesExport")
+    public AjaxResult exportExcel(TWarehousebillsfees tWarehousebillsfees) {
+        LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest());
+        tWarehousebillsfees.setCreateBy(loginUser.getUser().getNickName());
+        List<String> fleetExcel = tWarehousebillsfeesService.selectFleetExcel(tWarehousebillsfees);
+        List<FleetExcel> list = tWarehousebillsfeesService.selectFleetExcelList(tWarehousebillsfees);
+        ExcelUtil<FleetExcel> util = new ExcelUtil<FleetExcel>(FleetExcel.class);
+        return util.feesExportExcel(list, "总账统计", fleetExcel);
+    }
+
+    /**
      * 获取仓库费用明细详细信息
      */
     @PreAuthorize("@ss.hasPermi('warehouseBusiness:warehousebillsfees:query')")

+ 101 - 0
ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java

@@ -309,6 +309,99 @@ public class ExcelUtil<T>
      * @param sheetName 工作表的名称
      * @return 结果
      */
+    public AjaxResult feesExportExcel(List<T> list, String sheetName, List<String> fees)
+    {
+        this.init(list, sheetName, Type.EXPORT);
+        return feesExportExcel(fees);
+    }
+
+    /**
+     * 对list数据源将其里面的数据导入到excel表单
+     *
+     * @return 结果
+     */
+    public AjaxResult feesExportExcel(List<String> fees)
+    {
+        OutputStream out = null;
+        try
+        {
+            // 取出一共有多少个sheet.
+            double sheetNo = Math.ceil(list.size() / sheetSize);
+            for (int index = 0; index <= sheetNo; index++)
+            {
+                createSheet(sheetNo, index);
+                // 产生一行
+                Row row = sheet.createRow(0);
+                int column = 0;
+                // 写入各个字段的列头名称
+                for (Object[] os : fields)
+                {
+                    Excel excel = (Excel) os[1];
+                    this.createCell(excel, row, column++);
+                }
+                if (Type.EXPORT.equals(type))
+                {
+                    fillExcelData(index, row);
+                    addStatisticsRow();
+                }
+            }
+            Row row = sheet.createRow(list.size() + 1);
+            row.createCell(1).setCellValue("全部累计");
+            if (StringUtils.isNotEmpty(fees)) {
+                if (StringUtils.isNotNull(fees.get(0))) {
+                    row.createCell(3).setCellValue(fees.get(0));
+                }
+                if (StringUtils.isNotNull(fees.get(1))) {
+                    row.createCell(4).setCellValue(fees.get(1));
+                }
+                if (StringUtils.isNotNull(fees.get(2))) {
+                    row.createCell(5).setCellValue(fees.get(2));
+                }
+            }
+            String filename = encodingFilename(sheetName);
+            out = new FileOutputStream(getAbsoluteFile(filename));
+            wb.write(out);
+            return AjaxResult.success(filename);
+        }
+        catch (Exception e)
+        {
+            log.error("导出Excel异常{}", e.getMessage());
+            throw new CustomException("导出Excel失败,请联系网站管理员!");
+        }
+        finally
+        {
+            if (wb != null)
+            {
+                try
+                {
+                    wb.close();
+                }
+                catch (IOException e1)
+                {
+                    e1.printStackTrace();
+                }
+            }
+            if (out != null)
+            {
+                try
+                {
+                    out.close();
+                }
+                catch (IOException e1)
+                {
+                    e1.printStackTrace();
+                }
+            }
+        }
+    }
+
+    /**
+     * 对list数据源将其里面的数据导入到excel表单
+     *
+     * @param list 导出数据集合
+     * @param sheetName 工作表的名称
+     * @return 结果
+     */
     public AjaxResult exportExcel(List<T> list, String sheetName)
     {
         this.init(list, sheetName, Type.EXPORT);
@@ -358,6 +451,14 @@ public class ExcelUtil<T>
                     addStatisticsRow();
                 }
             }
+            Row row = sheet.createRow(list.size() + 1);
+            row.createCell(1).setCellValue("全部累计");
+            row.createCell(3).setCellValue("仓储费");
+            row.createCell(4).setCellValue("出入库费用");
+            row.createCell(5).setCellValue("合计人民币");
+
+
+
             String filename = encodingFilename(sheetName);
             out = new FileOutputStream(getAbsoluteFile(filename));
             wb.write(out);

+ 2 - 2
ruoyi-fleet/src/main/resources/mapper/orderPlan/ftmsorderbillscarsMapper.xml

@@ -407,7 +407,7 @@
         </where>
     </select>
 
-    <select id="selectftmsorderbillscarsMapList" parameterType="ftmsorderbills" resultType="ftmsorderbillscarsExcel">
+    <select id="selectftmsorderbillscarsMapList" parameterType="ftmsorderbills" resultType="com.ruoyi.orderPlan.domain.FtmsorderbillscarsExcel">
         SELECT
             c.id,
             c.order_no orderNo,
@@ -524,7 +524,7 @@
             <if test="goodsId != null">and t.goods_id = #{goodsId}</if>
             <if test="driverTel != null">and c.driver_tel = #{driverTel}</if>
             <if test="orderStatus != null">and c.order_status = #{orderStatus}</if>
-            <if test="carStatus != null and carStatus == 'planDate'">and c.accept_date IS NOT NULL</if>
+            <if test="carStatus != null and carStatus == 'planDate'">and c.accept_date IS NULL</if>
             <if test="carStatus != null and carStatus == 'acceptDate'">and c.order_status = 20</if>
             <if test="carStatus != null and carStatus == 'loadDate'">and c.order_status = 40</if>
             <if test="carStatus != null and carStatus == 'mdLoadDate'">and c.order_status = 50</if>

+ 205 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/finance/excel/FleetExcel.java

@@ -0,0 +1,205 @@
+package com.ruoyi.finance.excel;
+
+import com.ruoyi.common.annotation.Excel;
+
+public class FleetExcel {
+
+    /** 对账人 */
+    @Excel(name = "对账人")
+    private String userName;
+
+    /** 客户 */
+    @Excel(name = "客户")
+    private String corpName;
+
+    /**
+     * 月份
+     */
+    @Excel(name = "月份")
+    private String feelMonth;
+
+    /**
+     * 仓储费
+     */
+    @Excel(name = "仓储费")
+    private String ccf;
+
+    /**
+     * 出入库费用
+     */
+    @Excel(name = "出入库费用")
+    private String fAmount;
+
+    /**
+     * 合计人民币
+     */
+    @Excel(name = "合计人民币")
+    private String totalAmount;
+
+    /**
+     * 账期
+     */
+    @Excel(name = "账期")
+    private String accountPeriod;
+
+    /**
+     * 协议到期日
+     */
+    @Excel(name = "协议到期日")
+    private String maturity;
+
+    /**
+     * 开发票情况
+     */
+    @Excel(name = "开发票情况")
+    private String isInvoice;
+
+    /**
+     * 是否超账期
+     */
+    @Excel(name = "是否超账期")
+    private String isAccountPeriod;
+
+    /**
+     * 库存(吨)
+     */
+    @Excel(name = "库存(吨)")
+    private String stock;
+
+    /**
+     * 应收款催收结果
+     */
+    @Excel(name = "应收款催收结果")
+    private String collectionResult;
+
+    /**
+     * 总开票金额
+     */
+    private String invamount;
+
+    public String getInvamount() {
+        return invamount;
+    }
+
+    public void setInvamount(String invamount) {
+        this.invamount = invamount;
+    }
+
+    public String getUserName() {
+        return userName;
+    }
+
+    public void setUserName(String userId) {
+        this.userName = userId;
+    }
+
+    public String getCorpName() {
+        return corpName;
+    }
+
+    public void setCorpName(String corpName) {
+        this.corpName = corpName;
+    }
+
+    public String getCcf() {
+        return ccf;
+    }
+
+    public void setCcf(String ccf) {
+        this.ccf = ccf;
+    }
+
+    public String getFeelMonth() {
+        return feelMonth;
+    }
+
+    public void setFeelMonth(String feelMonth) {
+        this.feelMonth = feelMonth;
+    }
+
+    public String getfAmount() {
+        return fAmount;
+    }
+
+    public void setfAmount(String fAmount) {
+        this.fAmount = fAmount;
+    }
+
+    public String getTotalAmount() {
+        return totalAmount;
+    }
+
+    public void setTotalAmount(String totalAmount) {
+        this.totalAmount = totalAmount;
+    }
+
+    public String getAccountPeriod() {
+        return accountPeriod;
+    }
+
+    public void setAccountPeriod(String accountPeriod) {
+        this.accountPeriod = accountPeriod;
+    }
+
+    public String getMaturity() {
+        return maturity;
+    }
+
+    public void setMaturity(String maturity) {
+        this.maturity = maturity;
+    }
+
+    public String getIsInvoice() {
+        return isInvoice;
+    }
+
+    public void setIsInvoice(String isInvoice) {
+        if ("T".equals(isInvoice)) {
+            this.isInvoice = "已开发票";
+        } else {
+            this.isInvoice = "未开发票";
+        }
+    }
+
+    public String getIsAccountPeriod() {
+        return isAccountPeriod;
+    }
+
+    public void setIsAccountPeriod(String isAccountPeriod) {
+        this.isAccountPeriod = isAccountPeriod;
+    }
+
+    public String getStock() {
+        return stock;
+    }
+
+    public void setStock(String stock) {
+        this.stock = stock;
+    }
+
+    public String getCollectionResult() {
+        return collectionResult;
+    }
+
+    public void setCollectionResult(String collectionResult) {
+        this.collectionResult = collectionResult;
+    }
+
+    @Override
+    public String toString() {
+        return "FleetExcel{" +
+                "userId='" + userName + '\'' +
+                ", corpName='" + corpName + '\'' +
+                ", feelMonth='" + feelMonth + '\'' +
+                ", ccf='" + ccf + '\'' +
+                ", fAmount='" + fAmount + '\'' +
+                ", totalAmount='" + totalAmount + '\'' +
+                ", accountPeriod='" + accountPeriod + '\'' +
+                ", maturity='" + maturity + '\'' +
+                ", isInvoice='" + isInvoice + '\'' +
+                ", isAccountPeriod='" + isAccountPeriod + '\'' +
+                ", stock='" + stock + '\'' +
+                ", collectionResult='" + collectionResult + '\'' +
+                '}';
+    }
+}

+ 14 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/domain/TWarehousebillsfees.java

@@ -8,6 +8,7 @@ import org.apache.commons.lang3.builder.ToStringStyle;
 
 import java.math.BigDecimal;
 import java.util.Date;
+import java.util.List;
 
 /**
  * 仓库费用明细对象 t_warehousebillsfees
@@ -274,6 +275,19 @@ public class TWarehousebillsfees extends BaseEntity {
     private String fBusinessType;
 
     /**
+     * 查询费用报表时间区间
+     */
+    private List<String> fBsdateList;
+
+    public List<String> getfBsdateList() {
+        return fBsdateList;
+    }
+
+    public void setfBsdateList(List<String> fBsdateList) {
+        this.fBsdateList = fBsdateList;
+    }
+
+    /**
      * 是否可修改 0 手动录入
      */
     private Long fSrcTypeId;

+ 16 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/mapper/TWarehousebillsfeesMapper.java

@@ -2,6 +2,7 @@ package com.ruoyi.warehouseBusiness.mapper;
 
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.finance.excel.FleetExcel;
 import com.ruoyi.warehouseBusiness.domain.TWarehousebillsfees;
 import org.apache.ibatis.annotations.Param;
 
@@ -98,4 +99,19 @@ public interface TWarehousebillsfeesMapper extends BaseMapper<TWarehousebillsfee
                                                      @Param("fDc") String fDc);
     int deleteFessByFPid(@Param("fPid") Long fPid,
                          @Param("fDc") String fDc);
+
+    /**
+     *  查询报表
+     * @param tWarehousebillsfees
+     * @return
+     */
+    List<FleetExcel> selectFleetExcelList(TWarehousebillsfees tWarehousebillsfees);
+
+    /**
+     *  查询报表合计
+     * @param tWarehousebillsfees
+     * @return
+     */
+    FleetExcel selectFleetExcel(TWarehousebillsfees tWarehousebillsfees);
+
 }

+ 15 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/ITWarehousebillsfeesService.java

@@ -1,6 +1,7 @@
 package com.ruoyi.warehouseBusiness.service;
 
 
+import com.ruoyi.finance.excel.FleetExcel;
 import com.ruoyi.warehouseBusiness.domain.TWarehousebillsfees;
 
 import java.util.List;
@@ -59,4 +60,18 @@ public interface ITWarehousebillsfeesService {
      * @return 结果
      */
     public int deleteTWarehousebillsfeesById(Long fId);
+
+    /**
+     *  查询报表
+     * @param tWarehousebillsfees
+     * @return
+     */
+    public List<FleetExcel> selectFleetExcelList(TWarehousebillsfees tWarehousebillsfees);
+
+    /**
+     *  查询报表合计
+     * @param tWarehousebillsfees
+     * @return
+     */
+    public List<String> selectFleetExcel(TWarehousebillsfees tWarehousebillsfees);
 }

+ 40 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/impl/TWarehousebillsfeesServiceImpl.java

@@ -2,12 +2,15 @@ package com.ruoyi.warehouseBusiness.service.impl;
 
 
 import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.finance.excel.FleetExcel;
 import com.ruoyi.warehouseBusiness.domain.TWarehousebillsfees;
 import com.ruoyi.warehouseBusiness.mapper.TWarehousebillsfeesMapper;
 import com.ruoyi.warehouseBusiness.service.ITWarehousebillsfeesService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -88,4 +91,41 @@ public class TWarehousebillsfeesServiceImpl implements ITWarehousebillsfeesServi
     public int deleteTWarehousebillsfeesById(Long fId) {
         return tWarehousebillsfeesMapper.deleteTWarehousebillsfeesById(fId);
     }
+
+    /**
+     *  查询报表
+     * @param tWarehousebillsfees
+     * @return
+     */
+    @Override
+    public List<FleetExcel> selectFleetExcelList(TWarehousebillsfees tWarehousebillsfees) {
+        return tWarehousebillsfeesMapper.selectFleetExcelList(tWarehousebillsfees);
+    }
+
+    /**
+     *  查询报表合计
+     * @param tWarehousebillsfees
+     * @return
+     */
+    @Override
+    public List<String> selectFleetExcel(TWarehousebillsfees tWarehousebillsfees) {
+        FleetExcel fleetExcel = tWarehousebillsfeesMapper.selectFleetExcel(tWarehousebillsfees);
+        List<String> stringList = new ArrayList<>();
+        if (StringUtils.isNotEmpty(fleetExcel.getCcf())) {
+            stringList.add(fleetExcel.getCcf());
+        } else {
+            stringList.add("0");
+        }
+        if (StringUtils.isNotEmpty(fleetExcel.getfAmount())) {
+            stringList.add(fleetExcel.getfAmount());
+        } else {
+            stringList.add("0");
+        }
+        if (StringUtils.isNotEmpty(fleetExcel.getTotalAmount())) {
+            stringList.add(fleetExcel.getTotalAmount());
+        } else {
+            stringList.add("0");
+        }
+        return stringList;
+    }
 }

+ 56 - 0
ruoyi-warehouse/src/main/resources/mapper/warehouseBusiness/TWarehousebillsfeesMapper.xml

@@ -174,6 +174,7 @@
         <include refid="selectTWarehousebillsfeesVo"/>
         where f_pid = #{fId}
     </select>
+
     <select id="selectReconciliation" resultType="java.lang.Integer">
         SELECT COUNT(d.f_id)
         FROM t_fee_do d
@@ -181,6 +182,7 @@
         WHERE d.f_srcpid = #{fId}
           AND f.f_billtype = 'DZ'
     </select>
+
     <select id="selectCharge" resultType="java.lang.Integer">
         SELECT COUNT(d.f_id)
         FROM t_fee_do d
@@ -188,6 +190,7 @@
         WHERE d.f_srcpid = #{fId}
           AND f.f_billtype = 'SF'
     </select>
+
     <select id="selectPay" resultType="java.lang.Integer">
         SELECT COUNT(d.f_id)
         FROM t_fee_do d
@@ -196,6 +199,57 @@
           AND f.f_billtype = 'FF'
     </select>
 
+    <select id="selectFleetExcelList" parameterType="TWarehousebillsfees" resultType="com.ruoyi.finance.excel.FleetExcel">
+        SELECT
+            #{createBy} userName,
+            CONCAT(
+            YEAR ( s.f_bsdate ),
+            '-',
+            MONTH ( s.f_bsdate )) feelMonth,
+            c.f_name corpName,
+            sum( CASE WHEN s.f_feeid = 27 THEN s.f_amount ELSE 0 END ) ccf,
+            sum( CASE WHEN s.f_feeid != 27 THEN s.f_amount ELSE 0 END ) fAmount,
+            sum( s.f_amount ) totalAmount,
+            IF
+            ( f_invamount = 0, 'F', 'T' ) isInvoice,
+            sum( s.f_invamount ) invamount,
+            ROUND( sum( t.f_grossweightblc / 1000 ), 2 ) stock
+        FROM
+            t_warehousebillsfees s
+            LEFT JOIN t_corps c ON s.f_corpid = c.f_id
+            LEFT JOIN t_whgenleg t ON t.f_corpid = s.f_corpid
+        WHERE
+            s.f_dc = 'D'
+            <if test='fBsdateList != null and fBsdateList[0] != null and fBsdateList[0]!= ""'>
+                and s.f_bsdate &gt;= #{fBsdateList[0]}
+            </if>
+            <if test='fBsdateList != null and fBsdateList[1] != null and fBsdateList[1]!= ""'>
+                and s.f_bsdate &lt;= #{fBsdateList[1]}
+            </if>
+            GROUP BY CONCAT( YEAR ( f_bsdate ), '-', MONTH ( f_bsdate )), s.f_corpid, c.f_name
+    </select>
+
+    <select id="selectFleetExcel" parameterType="TWarehousebillsfees" resultType="com.ruoyi.finance.excel.FleetExcel">
+        SELECT
+            CONCAT(
+            YEAR ( s.f_bsdate ),
+            '-',
+            MONTH ( s.f_bsdate )) feelMonth,
+            sum( CASE WHEN s.f_feeid = 27 THEN s.f_amount ELSE 0 END ) ccf,
+            sum( CASE WHEN s.f_feeid != 27 THEN s.f_amount ELSE 0 END ) fAmount,
+            sum( s.f_amount ) totalAmount
+        FROM
+            t_warehousebillsfees s
+            LEFT JOIN t_corps c ON s.f_corpid = c.f_id
+        WHERE
+            s.f_dc = 'D'
+            <if test='fBsdateList != null and fBsdateList[0] != null and fBsdateList[0]!= ""'>
+                and s.f_bsdate &gt;= #{fBsdateList[0]}
+            </if>
+            <if test='fBsdateList != null and fBsdateList[1] != null and fBsdateList[1]!= ""'>
+                and s.f_bsdate &lt;= #{fBsdateList[1]}
+            </if>
+    </select>
 
     <insert id="insertTWarehousebillsfees" parameterType="TWarehousebillsfees" useGeneratedKeys="true"
             keyProperty="fId">
@@ -416,6 +470,7 @@
         </trim>
         where f_id = #{map.tFeeDo.fSrcid}
     </update>
+
     <select id="selectFeesByPId" parameterType="Long" resultMap="TWarehousebillsfeesResult">
         SELECT
         tw.f_id,
@@ -477,6 +532,7 @@
           and tw.f_billtype = 'KHDD'
         <if test="fDc != null  and fDc != ''">and tw.f_dc = #{fDc}</if>
     </select>
+
     <delete id="deleteFessByFPid" parameterType="object">
         delete
         from t_warehousebillsfees