package com.tofly.xrtygis.custom.mapper;

import com.tofly.xrtygis.custom.entity.vo.CostVo;
import com.tofly.xrtygis.custom.entity.vo.MarkWaterVo;
import org.apache.ibatis.annotations.Select;
import org.springframework.data.repository.query.Param;

import java.util.List;
import java.util.Map;

/**
 * @author 20126
 */
public interface DataMonthPlanMapper {

    /* ********************制水材料*********************** */

    /**
     * 获取一厂制水材料月度实际（财务）
     *
     * @param year 年月 yyyy-MM
     * @return MarkWaterVo
     */
    MarkWaterVo getOneMonthActual(@Param("year") String year);

    /**
     * 获取二厂制水材料月度实际（财务）
     *
     * @param year 年月 yyyy-MM
     * @return MarkWaterVo
     */
    MarkWaterVo getTwoMonthActual(@Param("year") String year);

    /**
     * 获取一厂制水材料月度计划（预算）
     *
     * @param year 年月
     * @return MarkWaterVo
     */
    MarkWaterVo getOneMonthPlan(@Param("year") String year);

    /**
     * 获取二厂制水材料月度计划（预算）
     *
     * @param year 年月
     * @return MarkWaterVo
     */
    MarkWaterVo getTwoMonthPlan(@Param("year") String year);

    /**
     * 获取一厂制水材料月度累计值
     *
     * @param year 年份
     * @return MarkWaterVo
     */
    MarkWaterVo getOneMonthPile(@Param("year") String year);

    /**
     * 获取二厂制水材料月度累计值
     *
     * @param year 年份
     * @return MarkWaterVo
     */
    MarkWaterVo getTwoMonthPile(@Param("year") String year);

    /**
     * 获取一厂信息
     *
     * @param year 年月
     * @return list
     */
    List<Map> getOneInfo(@Param("year") String year);

    /**
     * 获取二厂信息
     *
     * @param year 年月
     * @return list
     */
    List<Map> getTwoInfo(@Param("year") String year);

    MarkWaterVo getMonthActual(@Param("year") String year);

    MarkWaterVo getMonthPlan(@Param("year") String year);

    MarkWaterVo getMonthPile(@Param("year") String year);

    List<Map> getInfo(@Param("year") String year);

    /* ************************成本核算************************ */

    /**
     * 一厂材料核算（财务）
     */
    @Select("select round(PACZFY_ONE, 4)    pacfy,\n" +
            "       round(SYZFY_ONE, 4)     syfy,\n" +
            "       round(CNZFY, 4)         cnfy,\n" +
            "       round(BCSZFY, 4)        bcsfy,\n" +
            "       round(JBDF_ONE, 4)      jbdf,\n" +
            "       round(DLDF_ONE, 4)      dldf,\n" +
            "       round(YSF, 4)           YSF,\n" +
            "       round(SZYSF_ONE, 4)     szysf,\n" +
            "       round(PACCB_ONE, 4)     paccb,\n" +
            "       round(ZZSCLFY_ONE, 4)   zsclfy,\n" +
            "       round(ZFY_ONE, 4)       zfy,\n" +
            "       round(DFCB_ONE, 4)      dfcb,\n" +
            "       round(ZSCLCB_ONE, 4)    zzsclcb,\n" +
            "       round(YSFCB, 4)         YSFCB,\n" +
            "       round(SZYSFCB_ONE, 4)   szysfcb,\n" +
            "       round(DWCB_ONE, 4)      dwbdcb,\n" +
            "       round(SYDJ, 4)          SYDJ,\n" +
            "       round(CNDJ, 4)          CNDJ,\n" +
            "       round(BCSDJ, 4)         BCSDJ,\n" +
            "       round(OTHERDJ, 4)       OTHERDJ,\n" +
            "       round(OTHERZFY, 4)      OTHERZFY,\n" +
            "       round(OTHERCB, 4)       OTHERCB,\n" +
            "       round(OTHER_ONE_DJ, 4)  otherOneDj,\n" +
            "       round(OTHER_ONE_ZFY, 4) otherOneZfy,\n" +
            "       round(OTHER_ONE_CB, 4)  otherOneCb\n" +
            "from TF_YWPN_COSTRLFIXED_W f,\n" +
            "     TF_YWPN_COSTRLPRICE_W p\n" +
            "where to_char(f.UP_DATE, 'yyyy') = p.YEAR\n" +
            "  and f.MARK = 1\n" +
            "  and p.ISNEW = 1\n" +
            "  and to_char(f.UP_DATE, 'yyyy-mm') = #{year}")
    CostVo viewOneMonthActual(@Param("year") String year);

    /**
     * 二厂材料核算（财务）
     */
    @Select("select round(PACZFY_TWO, 4)    pacfy,\n" +
            "       round(YLZFY_TWO, 4)     ylfy,\n" +
            "       round(PAMZSZFY, 4)      pamzs,\n" +
            "       round(FTZFY, 4)         ftfy,\n" +
            "       round(GMSJFHYZFY, 4)    gmsjfy,\n" +
            "       round(PAMWNZFY, 4)      pamwn,\n" +
            "       round(WNZYF, 4)         wnzyfy,\n" +
            "       round(JBDF_TWO, 4)      jbdf,\n" +
            "       round(DLDF_TWO, 4)      dldf,\n" +
            "       round(SZYSF_TWO, 4)     szysf,\n" +
            "       round(ZZSCLFY_TWO, 4)   zsclfy,\n" +
            "       round(ZFY_TWO, 4)       zfy,\n" +
            "       round(DFCB_TWO, 4)      dfcb,\n" +
            "       round(YLDJ, 4)          YLDJ,\n" +
            "       round(FTDJ, 4)          FTDJ,\n" +
            "       round(WNZYDJ, 4)        WNZYDJ,\n" +
            "       round(PAM_ZSDJ, 4)      pamzsdj,\n" +
            "       round(GMSJFHYDJ, 4)     gmsjdj,\n" +
            "       round(ZSCLCB_ONE, 4)    zzsclcb,\n" +
            "       round(PAM_WNDJ, 4)      pamwndj,\n" +
            "       round(PACCB_TWO, 4)     paccb,\n" +
            "       round(ZSCLCB_TWO, 4)    zzsclcb,\n" +
            "       round(SZYSFCB_TWO, 4)   szysfcb,\n" +
            "       round(DWCB_TWO, 4)      dwbdcb,\n" +
            "       round(CNDJ, 4)          cndj,\n" +
            "       round(CNZFY_TWO)        cnfy,\n" +
            "       round(OTHER_TWO_DJ, 4)  otherTwoDj,\n" +
            "       round(OTHER_TWO_CB, 4)  otherTwoCb,\n" +
            "       round(OTHER_TWO_ZFY, 4) otherTwoZfy\n" +
            "from TF_YWPN_COSTRLFIXED_W fix\n" +
            "         full join TF_YWPN_COSTRLPRICE_W pri\n" +
            "                   on to_char(fix.UP_DATE, 'yyyy') = pri.YEAR and pri.ISNEW = '1'\n" +
            "where MARK = '1'\n" +
            "  and to_char(fix.UP_DATE, 'yyyy-mm') = #{year}")
    CostVo viewTwoMonthActual(@Param("year") String year);


    /**
     * 一厂材料核算（计划）
     */
    @Select("select round(PACZFY_ONE, 4)    pacfy,\n" +
            "       round(SYZFY_ONE, 4)     syfy,\n" +
            "       round(CNZFY, 4)         cnfy,\n" +
            "       round(BCSZFY, 4)        bcsfy,\n" +
            "       round(JBDF_ONE, 4)      jbdf,\n" +
            "       round(DLDF_ONE, 4)      dldf,\n" +
            "       round(YSF, 4)           YSF,\n" +
            "       round(SZYSF_ONE, 4)     szysf,\n" +
            "       round(PACCB_ONE, 4)     paccb,\n" +
            "       round(ZZSCLFY_ONE, 4)   zsclfy,\n" +
            "       round(ZFY_ONE, 4)       zfy,\n" +
            "       round(DFCB_ONE, 4)      dfcb,\n" +
            "       round(ZSCLCB_ONE, 4)    zzsclcb,\n" +
            "       round(YSFCB, 4)         YSFCB,\n" +
            "       round(SZYSFCB_ONE, 4)   szysfcb,\n" +
            "       round(DWCB_ONE, 4)      dwbdcb,\n" +
            "       round(SYDJ, 4)          SYDJ,\n" +
            "       round(CNDJ, 4)          CNDJ,\n" +
            "       round(BCSDJ, 4)         BCSDJ,\n" +
            "       round(OTHERDJ, 4)       OTHERDJ,\n" +
            "       round(OTHERZFY, 4)      OTHERZFY,\n" +
            "       round(OTHERCB, 4)       OTHERCB,\n" +
            "       round(OTHER_ONE_DJ, 4)  otherOneDj,\n" +
            "       round(OTHER_ONE_ZFY, 4) otherOneZfy,\n" +
            "       round(OTHER_ONE_CB, 4)  otherOneCb\n" +
            "from TF_YWPN_COSTBGFIXED_W fix\n" +
            "         full join (select *\n" +
            "                    from (select *\n" +
            "                          from TF_YWPN_COSTBGPRICE_W\n" +
            "                          where YEAR = substr(#{year}, 1, 4)\n" +
            "                          order by create_time)\n" +
            "                    where rownum = 1) pri\n" +
            "                   on substr(fix.MOUTH, 1, 4) = pri.YEAR\n" +
            "where MOUTH = #{year}")
    CostVo viewOneMonthPlan(@Param("year") String year);

    /**
     * 二厂材料核算（计划）
     */
    @Select("select round(PACZFY_TWO, 4)    pacfy,\n" +
            "       round(YLZFY_TWO, 4)     ylfy,\n" +
            "       round(PAMZSZFY, 4)      pamzs,\n" +
            "       round(FTZFY, 4)         ftfy,\n" +
            "       round(GMSJFHYZFY, 4)    gmsjfy,\n" +
            "       round(PAMWNZFY, 4)      pamwn,\n" +
            "       round(WNZYF, 4)         wnzyfy,\n" +
            "       round(JBDF_TWO, 4)      jbdf,\n" +
            "       round(DLDF_TWO, 4)      dldf,\n" +
            "       round(SZYSF_TWO, 4)     szysf,\n" +
            "       round(ZZSCLFY_TWO, 4)   zsclfy,\n" +
            "       round(ZFY_TWO, 4)       zfy,\n" +
            "       round(DFCB_TWO, 4)      dfcb,\n" +
            "       round(PACCB_TWO, 4)     paccb,\n" +
            "       round(PAM_ZSDJ, 4)      pamzsdj,\n" +
            "       round(GMSJFHYDJ, 4)     gmsjdj,\n" +
            "       round(ZSCLCB_ONE, 4)    zzsclcb,\n" +
            "       round(PAM_WNDJ, 4)      pamwndj,\n" +
            "       round(WNZYDJ, 4)        wnzydj,\n" +
            "       round(ZSCLCB_TWO, 4)    zzsclcb,\n" +
            "       round(SZYSFCB_TWO, 4)   szysfcb,\n" +
            "       round(DWCB_TWO, 4)      dwbdcb,\n" +
            "       round(CNZFY_TWO, 4)     cnfy,\n" +
            "       round(CNDJ, 4)          cndj,\n" +
            "       round(FTDJ, 4)          ftdj,\n" +
            "       round(YLDJ, 4)          yldj,\n" +
            "       round(OTHER_TWO_DJ, 4)  otherTwoDj,\n" +
            "       round(OTHER_TWO_ZFY, 4) otherTwoZfy,\n" +
            "       round(OTHER_TWO_CB, 4)  otherTwoCb\n" +
            "from TF_YWPN_COSTBGFIXED_W fix\n" +
            "         full join (select *\n" +
            "                    from (select *\n" +
            "                          from TF_YWPN_COSTBGPRICE_W\n" +
            "                          where YEAR = substr(#{year}, 1, 4)\n" +
            "                          order by create_time)\n" +
            "                    where rownum = 1) pri\n" +
            "                   on substr(fix.MOUTH, 1, 4) = pri.YEAR\n" +
            "where MOUTH = #{year}")
    CostVo viewTwoMonthPlan(@Param("year") String year);

    /**
     * 获取一厂成本核算月度累计值
     */
    @Select("select round(sum(PACZFY_ONE), 4)                                                  pacfy,\n" +
            "       round(sum(SYZFY_ONE), 4)                                                   syfy,\n" +
            "       round(sum(CNZFY), 4)                                                       cnfy,\n" +
            "       round(sum(BCSZFY), 4)                                                      bcsfy,\n" +
            "       round(sum(JBDF_ONE), 4)                                                    jbdf,\n" +
            "       round(sum(DLDF_ONE), 4)                                                    dldf,\n" +
            "       round(sum(YSF), 4)                                                         ysf,\n" +
            "       round(sum(SZYSF_ONE), 4)                                                   szysf,\n" +
            "       round(sum(ZZSCLFY_ONE), 4)                                                 zsclfy,\n" +
            "       round(sum(ZFY_ONE), 4)                                                     zfy,\n" +
            "       round(sum(SYDJ ), 4)                                                             SYDJ,\n" +
            "       round(sum(CNDJ ), 4)                                                             CNDJ,\n" +
            "       round(sum(BCSDJ), 4)                                                            BCSDJ,\n" +
            "       round(sum(OTHERDJ), 4)                                                     otherdj,\n" +
            "       round(sum(OTHER_ONE_DJ), 4)                                                otherOneDj,\n" +
            "       round(sum(OTHERZFY), 4)                                                    OTHERZFY,\n" +
            "       round(sum(OTHER_ONE_ZFY), 4)                                               otherOneZfy,\n" +
            "       round(sum(OTHERZFY) / nullif(sum(GSL_ONE), 0) * 1000, 4)                   othercb,\n" +
            "       round(sum(OTHER_ONE_ZFY) / nullif(sum(GSL_ONE), 0) * 1000, 4)              otherOneCb,\n" +
            "       round((sum(JBDF_ONE) + sum(DLDF_ONE)) / nullif(sum(GSL_ONE), 0) * 1000, 4) dfcb,\n" +
            "       round(sum(zzsclfy_one) / nullif(sum(GSL_ONE), 0) * 1000, 4)                zzsclcb,\n" +
            "       round(sum(PACZFY_ONE) / nullif(sum(GSL_ONE), 0) * 1000, 4)                 paccb,\n" +
            "       round(sum(ysf) / nullif(sum(GSL_ONE), 0) * 1000, 4)                        ysfcb,\n" +
            "       round(sum(szysf_one) / nullif(sum(GSL_ONE), 0) * 1000, 4)                  szysfcb,\n" +
            "       round(sum(zfy_one) / nullif(sum(GSL_ONE), 0) * 1000, 4)                    dwbdcb\n" +
            "from TF_YWPN_COSTRLWATER_W w\n" +
            "         right join TF_YWPN_COSTRLFIXED_W f\n" +
            "                    on to_char(f.up_date, 'yyyy-mm-dd') = to_char(w.up_date, 'yyyy-mm-dd') and f.MARK = w.MARK\n" +
            "         left join TF_YWPN_COSTRLPRICE_W p on to_char(f.UP_DATE, 'yyyy') = p.YEAR\n" +
            "\n" +
            "where f.MARK = '0'\n" +
            "  and p.ISNEW = '1'\n" +
            "  and to_char(f.UP_DATE, 'yyyy-mm') = #{year}\n" +
            "group by to_char(f.UP_DATE, 'yyyy-mm')")
    CostVo viewOneMonthPile(@Param("year") String year);

    /**
     * 获取二厂成本核算月度累计值
     */
    @Select("select round(sum(PACZFY_TWO), 4)                                                  pacfy,\n" +
            "       round(sum(YLZFY_TWO), 4)                                                   ylfy,\n" +
            "       round(sum(PAMZSZFY), 4)                                                    pamzs,\n" +
            "       round(sum(FTZFY), 4)                                                       ftfy,\n" +
            "       round(sum(GMSJFHYZFY), 4)                                                  gmsjfy,\n" +
            "       round(sum(PAMWNZFY), 4)                                                    pamwn,\n" +
            "       round(sum(WNZYF), 4)                                                       wnzyfy,\n" +
            "       round(sum(JBDF_TWO), 4)                                                    jbdf,\n" +
            "       round(sum(DLDF_TWO), 4)                                                    dldf,\n" +
            "       round(sum(SZYSF_TWO), 4)                                                   szysf,\n" +
            "       round(sum(ZZSCLFY_TWO), 4)                                                 zsclfy,\n" +
            "       round(sum(ZFY_TWO), 4)                                                     zfy,\n" +
            "       round(YLDJ, 4)                                                             yldj,\n" +
            "       round(PAM_ZSDJ, 4)                                                         pamzsdj,\n" +
            "       round(GMSJFHYDJ, 4)                                                        gmsjdj,\n" +
            "       round(FTDJ, 4)                                                             ftdj,\n" +
            "       round(PAM_WNDJ, 4)                                                         pamwndj,\n" +
            "       round(WNZYDJ, 4)                                                           wnzydj,\n" +
            "       round(sum(OTHER_TWO_ZFY), 4)                                               otherTwoZfy,\n" +
            "       round(OTHER_TWO_DJ, 4)                                                     otherTwoDj,\n" +
            "       round(CNDJ, 4)                                                             cndj,\n" +
            "       round(sum(CNZFY_TWO), 4)                                                   cnfy,\n" +
            "       round(sum(OTHER_TWO_ZFY) / nullif(sum(GSL_TWO), 0) * 1000, 4)              otherTwoCb,\n" +
            "       round((sum(JBDF_TWO) + sum(DLDF_TWO)) / nullif(sum(GSL_TWO), 0) * 1000, 4) dfcb,\n" +
            "       round(sum(zzsclfy_two) / nullif(sum(GSL_TWO), 0) * 1000, 4)                zzsclcb,\n" +
            "       round(sum(PACZFY_TWO) / nullif(sum(GSL_TWO), 0) * 1000, 4)                 paccb,\n" +
            "       round(sum(szysf_two) / nullif(sum(GSL_TWO), 0) * 1000, 4)                  szysfcb,\n" +
            "       round(sum(zfy_two) / nullif(sum(GSL_TWO), 0) * 1000, 4)                    dwbdcb\n" +
            "from TF_YWPN_COSTRLWATER_W w\n" +
            "         right join TF_YWPN_COSTRLFIXED_W f\n" +
            "                    on to_char(f.up_date, 'yyyy-mm-dd') = to_char(w.up_date, 'yyyy-mm-dd') and f.MARK = w.MARK\n" +
            "         left join TF_YWPN_COSTRLPRICE_W p on to_char(f.UP_DATE, 'yyyy') = p.YEAR\n" +
            "\n" +
            "where f.MARK = '0'\n" +
            "  and p.ISNEW = '1'\n" +
            "  and to_char(f.UP_DATE, 'yyyy-mm') = #{year}\n" +
            "group by to_char(f.UP_DATE, 'yyyy-mm'), YLDJ, PAM_ZSDJ, GMSJFHYDJ, FTDJ, PAM_WNDJ, WNZYDJ, OTHER_TWO_DJ, CNDJ")
    CostVo viewTwoMonthPile(@Param("year") String year);


    /**
     * 获取一厂信息
     */
    @Select("select to_char(fix.UP_DATE, 'yyyy-mm-dd') day,\n" +
            "       round(PACZFY_ONE, 4)               pacfy,\n" +
            "       round(SYZFY_ONE, 4)                syfy,\n" +
            "       round(CNZFY, 4)                    cnfy,\n" +
            "       round(BCSZFY, 4)                   bcsfy,\n" +
            "       round(JBDF_ONE, 4)                 jbdf,\n" +
            "       round(DLDF_ONE, 4)                 dldf,\n" +
            "       round(YSF, 4)                      YSF,\n" +
            "       round(SZYSF_ONE, 4)                szysf,\n" +
            "       round(ZZSCLFY_ONE, 4)              zsclfy,\n" +
            "       round(ZFY_ONE, 4)                  zfy,\n" +
            "       round(DFCB_ONE, 4)                 dfcb,\n" +
            "       round(SYDJ, 4)                     SYDJ,\n" +
            "       round(CNDJ, 4)                     CNDJ,\n" +
            "       round(BCSDJ, 4)                    BCSDJ,\n" +
            "       round(ZSCLCB_ONE, 4)               zzsclcb,\n" +
            "       round(PACCB_ONE, 4)                paccb,\n" +
            "       round(YSFCB, 4)                    YSFCB,\n" +
            "       round(SZYSFCB_ONE, 4)              szysfcb,\n" +
            "       round(DWCB_ONE, 4)                 dwbdcb,\n" +
            "       round(OTHERDJ, 4)                  OTHERDJ,\n" +
            "       round(OTHERCB, 4)                  OTHERCB,\n" +
            "       round(OTHERZFY, 4)                 OTHERZFY,\n" +
            "       round(OTHER_ONE_DJ, 4)             other_one_dj,\n" +
            "       round(OTHER_ONE_ZFY, 4)            other_one_zfy,\n" +
            "       round(OTHER_ONE_CB, 4)             other_one_cb\n" +
            "from TF_YWPN_COSTRLFIXED_W fix\n" +
            "         full join TF_YWPN_COSTRLPRICE_W pri\n" +
            "                   on to_char(fix.UP_DATE, 'yyyy') = pri.YEAR and pri.ISNEW = '1'\n" +
            "where MARK = '0'\n" +
            "  and to_char(fix.UP_DATE, 'yyyy-mm') = #{year}\n" +
            "order by day")
    List<Map<String, Object>> viewOneInfo(@Param("year") String year);

    /**
     * 获取二厂信息
     */
    @Select("select to_char(fix.UP_DATE, 'yyyy-mm-dd') day,\n" +
            "       round(PACZFY_TWO, 4)               pacfy,\n" +
            "       round(YLZFY_TWO, 4)                ylfy,\n" +
            "       round(PAMZSZFY, 4)                 pamzs,\n" +
            "       round(FTZFY, 4)                    ftfy,\n" +
            "       round(GMSJFHYZFY, 4)               gmsjfy,\n" +
            "       round(PAMWNZFY, 4)                 pamwn,\n" +
            "       round(WNZYF, 4)                    wnzyfy,\n" +
            "       round(JBDF_TWO, 4)                 jbdf,\n" +
            "       round(DLDF_TWO, 4)                 dldf,\n" +
            "       round(SZYSF_TWO, 4)                szysf,\n" +
            "       round(ZZSCLFY_TWO, 4)              zsclfy,\n" +
            "       round(ZFY_TWO, 4)                  zfy,\n" +
            "       round(DFCB_TWO, 4)                 dfcb,\n" +
            "       round(YLDJ, 4)                     yldj,\n" +
            "       round(PAM_ZSDJ, 4)                 pamzsdj,\n" +
            "       round(GMSJFHYDJ, 4)                gmsjdj,\n" +
            "       round(ZSCLCB_ONE, 4)               zzsclcb,\n" +
            "       round(FTDJ, 4)                     ftdj,\n" +
            "       round(PAM_WNDJ, 4)                 pamwndj,\n" +
            "       round(WNZYDJ, 4)                   wnzydj,\n" +
            "       round(ZSCLCB_TWO, 4)               zzsclcb,\n" +
            "       round(paccb_two, 4)                paccb,\n" +
            "       round(SZYSFCB_TWO, 4)              szysfcb,\n" +
            "       round(DWCB_TWO, 4)                 dwbdcb,\n" +
            "       round(OTHER_TWO_DJ, 4)             otherTwoDj,\n" +
            "       round(OTHER_TWO_ZFY, 4)            otherTwoZfy,\n" +
            "       round(OTHER_TWO_CB, 4)             otherTwoCb,\n" +
            "       round(CNDJ, 4)                     cndj,\n" +
            "       round(CNZFY_TWO, 4)                cnfy\n" +
            "from TF_YWPN_COSTRLFIXED_W fix\n" +
            "         full join TF_YWPN_COSTRLPRICE_W pri\n" +
            "                   on to_char(fix.UP_DATE, 'yyyy') = pri.YEAR and pri.ISNEW = '1'\n" +
            "where MARK = '0'\n" +
            "  and to_char(fix.UP_DATE, 'yyyy-mm') = #{year}\n" +
            "order by day")
    List<Map<String, Object>> viewTwoInfo(@Param("year") String year);

    @Select("select round((PACZFY_ONE + PACZFY_TWO), 4)                               pacfy,\n" +
            "       round(JBDF_TOTAL, 4)                                              jbdf,\n" +
            "       round(DLDF_TOTAL, 4)                                              dldf,\n" +
            "       round(SZYSF_TOTAL, 4)                                             szysf,\n" +
            "       round(ZZSCLFY_ONE + ZZSCLFY_TWO, 4)                               zsclzfy,\n" +
            "       round(ZFY, 4)                                                     zfy,\n" +
            "       round(DFCB_TOTAL, 4)                                              dfcb,\n" +
            "       round(ZSCLCB_TOTAL, 4)                                            zzslccb,\n" +
            "       round(SZYSFCB_TOTAL, 4)                                           szysfcb,\n" +
            "       round(DWCB_TOTAL, 4)                                              dwbdcb,\n" +
            "       round(SYZFY_ONE, 4)                                               syfy,\n" +
            "       round((CNZFY + CNZFY_TWO), 4)                                     cnfy,\n" +
            "       round(BCSZFY, 4)                                                  bcsfy,\n" +
            "       round(YSF, 4)                                                     yfg,\n" +
            "       round(YSFCB, 4)                                                   ysfcb,\n" +
            "       round(SYDJ, 4)                                                    sydj,\n" +
            "       round(CNDJ, 4)                                                    cndj,\n" +
            "       round(BCSDJ, 4)                                                   bcsdj,\n" +
            "       round(YLZFY_TWO, 4)                                               ylfy,\n" +
            "       round(PAMZSZFY, 4)                                                pamzs,\n" +
            "       round(FTZFY, 4)                                                   ftfy,\n" +
            "       round(GMSJFHYZFY, 4)                                              gmsjfy,\n" +
            "       round(PAMWNZFY, 4)                                                pamwn,\n" +
            "       round(WNZYF, 4)                                                   wnzyfy,\n" +
            "       round(YLDJ, 4)                                                    yldj,\n" +
            "       round(PAM_ZSDJ, 4)                                                pamzsdj,\n" +
            "       round(GMSJFHYDJ, 4)                                               gmsjdj,\n" +
            "       round(FTDJ, 4)                                                    ftdj,\n" +
            "       round(PAM_WNDJ, 4)                                                pamwndj,\n" +
            "       round(WNZYDJ, 4)                                                  wnzydj,\n" +
            "       round(OTHERDJ, 4)                                                 otherdj,\n" +
            "       round(OTHER_ONE_DJ, 4)                                            otherOneDj,\n" +
            "       round(OTHER_TWO_DJ, 4)                                            otherTwoDj,\n" +
            "       round(OTHERZFY, 4)                                                otherzfy,\n" +
            "       round(OTHER_ONE_ZFY, 4)                                           otherOneZfy,\n" +
            "       round(OTHER_TWO_ZFY, 4)                                           otherTwoZfy,\n" +
            "       round(OTHERCB, 4)                                                 othercb,\n" +
            "       round(OTHER_ONE_CB, 4)                                            otherOneCb,\n" +
            "       round(OTHER_TWO_CB, 4)                                            otherTwoCb,\n" +
            "       round((PACZFY_ONE + PACZFY_TWO) / nullif(GSL_TOTAL, 0) * 1000, 4) paccb\n" +
            "from TF_YWPN_COSTRLWATER_W w\n" +
            "         right join TF_YWPN_COSTRLFIXED_W f\n" +
            "                    on w.MARK = f.MARK and to_char(w.UP_DATE, 'yyyy-mm') = to_char(f.UP_DATE, 'yyyy-mm')\n" +
            "         left join TF_YWPN_COSTRLPRICE_W p\n" +
            "                   on to_char(f.UP_DATE, 'yyyy') = p.YEAR\n" +
            "where f.MARK = 1\n" +
            "  and p.ISNEW = 1\n" +
            "  and to_char(f.UP_DATE, 'yyyy-mm') = #{year}")
    CostVo viewSumMonthActual(@Param("year") String year);

    @Select("select round((PACZFY_ONE + PACZFY_TWO), 4)                               pacfy,\n" +
            "       round(JBDF_TOTAL, 4)                                              jbdf,\n" +
            "       round(DLDF_TOTAL, 4)                                              dldf,\n" +
            "       round(SZYSF_TOTAL, 4)                                             szysf,\n" +
            "       round(ZZSCLFY_ONE + ZZSCLFY_TWO, 4)                               zsclzfy,\n" +
            "       round(ZFY, 4)                                                     zfy,\n" +
            "       round(DFCB_TOTAL, 4)                                              dfcb,\n" +
            "       round(ZSCLCB_TOTAL, 4)                                            zzslccb,\n" +
            "       round(SZYSFCB_TOTAL, 4)                                           szysfcb,\n" +
            "       round(DWCB_TOTAL, 4)                                              dwbdcb,\n" +
            "       round(SYZFY_ONE, 4)                                               syfy,\n" +
            "       round((CNZFY + CNZFY_TWO), 4)                                     cnfy,\n" +
            "       round(BCSZFY, 4)                                                  bcsfy,\n" +
            "       round(YSF, 4)                                                     yfg,\n" +
            "       round(YSFCB, 4)                                                   ysfcb,\n" +
            "       round(SYDJ, 4)                                                    sydj,\n" +
            "       round(CNDJ, 4)                                                    cndj,\n" +
            "       round(BCSDJ, 4)                                                   bcsdj,\n" +
            "       round(YLZFY_TWO, 4)                                               ylfy,\n" +
            "       round(PAMZSZFY, 4)                                                pamzs,\n" +
            "       round(FTZFY, 4)                                                   ftfy,\n" +
            "       round(GMSJFHYZFY, 4)                                              gmsjfy,\n" +
            "       round(PAMWNZFY, 4)                                                pamwn,\n" +
            "       round(WNZYF, 4)                                                   wnzyfy,\n" +
            "       round(YLDJ, 4)                                                    yldj,\n" +
            "       round(PAM_ZSDJ, 4)                                                pamzsdj,\n" +
            "       round(GMSJFHYDJ, 4)                                               gmsjdj,\n" +
            "       round(FTDJ, 4)                                                    ftdj,\n" +
            "       round(PAM_WNDJ, 4)                                                pamwndj,\n" +
            "       round(WNZYDJ, 4)                                                  wnzydj,\n" +
            "       round(OTHERDJ, 4)                                                 otherdj,\n" +
            "       round(OTHER_ONE_DJ, 4)                                            otherOneDj,\n" +
            "       round(OTHER_TWO_DJ, 4)                                            otherTwoDj,\n" +
            "       round(OTHERZFY, 4)                                                otherzfy,\n" +
            "       round(OTHER_ONE_ZFY, 4)                                           otherOneZfy,\n" +
            "       round(OTHER_TWO_ZFY, 4)                                           otherTwoZfy,\n" +
            "       round(OTHERCB, 4)                                                 othercb,\n" +
            "       round(OTHER_ONE_CB, 4)                                            otherOneCb,\n" +
            "       round(OTHER_TWO_CB, 4)                                            otherTwoCb,\n" +
            "       round((PACZFY_ONE + PACZFY_TWO) / nullif(GSL_TOTAL, 0) * 1000, 4) paccb\n" +
            "from TF_YWPN_COSTBGWATER_W w\n" +
            "         right join TF_YWPN_COSTBGFIXED_W fix\n" +
            "                    on w.MONTH = fix.MOUTH\n" +
            "         left join (select *\n" +
            "                    from (select *\n" +
            "                          from TF_YWPN_COSTBGPRICE_W\n" +
            "                          where YEAR = substr(#{year}, 1, 4)\n" +
            "                          order by create_time)\n" +
            "                    where rownum = 1) pri\n" +
            "                   on substr(fix.MOUTH, 1, 4) = pri.YEAR\n" +
            "where fix.MOUTH = #{year}")
    CostVo viewSumMonthPlan(@Param("year") String year);

    @Select("select sum(PACZFY_ONE) + sum(PACZFY_TWO)                                                  pacfy,\n" +
            "       sum(JBDF_TOTAL)                                                                    jbdf,\n" +
            "       sum(DLDF_TOTAL)                                                                    dldf,\n" +
            "       sum(SZYSF_TOTAL)                                                                   szysf,\n" +
            "       sum(ZZSCLFY_ONE) + sum(ZZSCLFY_TWO)                                                zcclfy,\n" +
            "       sum(ZFY)                                                                           ZFY,\n" +
            "       sum(SYZFY_ONE)                                                                     syfy,\n" +
            "       sum(CNZFY + CNZFY_TWO)                                                             CNFY,\n" +
            "       sum(BCSZFY)                                                                        BCSFY,\n" +
            "       sum(YSF)                                                                           YSF,\n" +
            "       sum(YLZFY_TWO)                                                                     YLFY,\n" +
            "       sum(PAMZSZFY)                                                                      PAMZS,\n" +
            "       sum(FTZFY)                                                                         FTFY,\n" +
            "       sum(GMSJFHYZFY)                                                                    GMSJFY,\n" +
            "       sum(PAMWNZFY)                                                                      PAMWN,\n" +
            "       sum(WNZYF)                                                                         wnzyfy,\n" +
            "       OTHERDJ                                                                            otherdj,\n" +
            "       OTHER_ONE_DJ                                                                       otherOneDj,\n" +
            "       OTHER_TWO_DJ                                                                       otherTwoDj,\n" +
            "       sum(OTHERZFY)                                                                      otherzfy,\n" +
            "       sum(OTHER_ONE_ZFY)                                                                 otherOneZfy,\n" +
            "       sum(OTHER_TWO_ZFY)                                                                 otherTwoZfy,\n" +
            "       SYDJ                                                                               sydj,\n" +
            "       CNDJ                                                                               cndj,\n" +
            "       BCSDJ                                                                              bcsdj,\n" +
            "       YLDJ                                                                               yldj,\n" +
            "       PAM_ZSDJ                                                                           pamzsdj,\n" +
            "       GMSJFHYDJ                                                                          gmsjdj,\n" +
            "       FTDJ                                                                               ftdj,\n" +
            "       PAM_WNDJ                                                                           pamwndj,\n" +
            "       WNZYDJ                                                                             wnzydj,\n" +
            "       round((sum(PACZFY_ONE) + sum(PACZFY_TWO)) / nullif(sum(GSL_TOTAL), 0) * 1000, 4)   paccb,\n" +
            "       round((sum(JBDF_TOTAL) + sum(DLDF_TOTAL)) / nullif(sum(GSL_TOTAL), 0) * 1000, 4)   DFCB,\n" +
            "       round((sum(ZZSCLFY_ONE) + sum(ZZSCLFY_TWO)) / nullif(sum(GSL_TOTAL), 0) * 1000, 4) ZZSCLCB,\n" +
            "       round(sum(SZYSF_TOTAL) / nullif(sum(GSL_TOTAL), 0) * 1000, 4)                      SZYSFCB,\n" +
            "       round(sum(ZFY) / nullif(sum(GSL_TOTAL), 0) * 1000, 4)                              DWBDCB,\n" +
            "       round(sum(YSF) / nullif(sum(GSL_TOTAL), 0) * 1000, 4)                              YSFCB,\n" +
            "       round(sum(OTHERZFY) / nullif(sum(GSL_ONE), 0) * 1000, 4)                           othercb,\n" +
            "       round(sum(OTHER_ONE_ZFY) / nullif(sum(GSL_ONE), 0) * 1000, 4)                      otherOneCb,\n" +
            "       round(sum(OTHER_TWO_ZFY) / nullif(sum(GSL_TWO), 0) * 1000, 4)                      otherTwoCb\n" +
            "from TF_YWPN_COSTRLWATER_W w\n" +
            "         right join TF_YWPN_COSTRLFIXED_W f\n" +
            "                    on to_char(w.UP_DATE, 'yyyy-mm') = to_char(f.UP_DATE, 'yyyy-mm') and w.MARK = f.MARK\n" +
            "         left join TF_YWPN_COSTRLPRICE_W p\n" +
            "                   on to_char(f.UP_DATE, 'yyyy') = p.YEAR\n" +
            "where f.MARK = 1\n" +
            "  and p.ISNEW = 1\n" +
            "  and to_char(f.UP_DATE, 'yyyy-mm') = '2022-10'\n" +
            "group by to_char(f.UP_DATE, 'yyyy-mm'), SYDJ, CNDJ, BCSDJ, YLDJ, PAM_ZSDJ, GMSJFHYDJ, FTDJ, PAM_WNDJ, WNZYDJ, OTHERDJ,\n" +
            "         OTHER_ONE_DJ, OTHER_TWO_DJ")
    CostVo viewSumMonthPile(@Param("year") String year);

    @Select("select to_char(f.UP_DATE, 'yyyy-mm-dd')                                  day,\n" +
            "       round((PACZFY_ONE + PACZFY_TWO), 4)                               pacfy,\n" +
            "       round(JBDF_TOTAL, 4)                                              jbdf,\n" +
            "       round(DLDF_TOTAL, 4)                                              dldf,\n" +
            "       round(SZYSF_TOTAL, 4)                                             szysf,\n" +
            "       round(ZZSCLFY_ONE + ZZSCLFY_TWO, 4)                               zsclzfy,\n" +
            "       round(ZFY, 4)                                                     zfy,\n" +
            "       round(DFCB_TOTAL, 4)                                              dfcb,\n" +
            "       round(ZSCLCB_TOTAL, 4)                                            zzslccb,\n" +
            "       round(SZYSFCB_TOTAL, 4)                                           szysfcb,\n" +
            "       round(DWCB_TOTAL, 4)                                              dwbdcb,\n" +
            "       round(SYZFY_ONE, 4)                                               syfy,\n" +
            "       round((CNZFY + CNZFY_TWO), 4)                                     cnfy,\n" +
            "       round(BCSZFY, 4)                                                  bcsfy,\n" +
            "       round(YSF, 4)                                                     yfg,\n" +
            "       round(YSFCB, 4)                                                   ysfcb,\n" +
            "       round(SYDJ, 4)                                                    sydj,\n" +
            "       round(CNDJ, 4)                                                    cndj,\n" +
            "       round(BCSDJ, 4)                                                   bcsdj,\n" +
            "       round(YLZFY_TWO, 4)                                               ylfy,\n" +
            "       round(PAMZSZFY, 4)                                                pamzs,\n" +
            "       round(FTZFY, 4)                                                   ftfy,\n" +
            "       round(GMSJFHYZFY, 4)                                              gmsjfy,\n" +
            "       round(PAMWNZFY, 4)                                                pamwn,\n" +
            "       round(WNZYF, 4)                                                   wnzyfy,\n" +
            "       round(YLDJ, 4)                                                    yldj,\n" +
            "       round(PAM_ZSDJ, 4)                                                pamzsdj,\n" +
            "       round(GMSJFHYDJ, 4)                                               gmsjdj,\n" +
            "       round(FTDJ, 4)                                                    ftdj,\n" +
            "       round(PAM_WNDJ, 4)                                                pamwndj,\n" +
            "       round(WNZYDJ, 4)                                                  wnzydj,\n" +
            "       round(OTHERDJ, 4)                                                 otherdj,\n" +
            "       round(OTHER_ONE_DJ, 4)                                            other_one_dj,\n" +
            "       round(OTHER_TWO_DJ, 4)                                            other_two_dj,\n" +
            "       round(OTHERZFY, 4)                                                otherzfy,\n" +
            "       round(OTHER_ONE_ZFY, 4)                                           other_one_zfy,\n" +
            "       round(OTHER_TWO_ZFY, 4)                                           other_two_zfy,\n" +
            "       round(OTHERCB, 4)                                                 othercb,\n" +
            "       round(OTHER_ONE_CB, 4)                                            other_one_cb,\n" +
            "       round(OTHER_TWO_CB, 4)                                            other_two_cb,\n" +
            "       round((PACZFY_ONE + PACZFY_TWO) / nullif(GSL_TOTAL, 0) * 1000, 4) paccb\n" +
            "from TF_YWPN_COSTRLWATER_W w\n" +
            "         right join TF_YWPN_COSTRLFIXED_W f\n" +
            "                    on w.MARK = f.MARK and to_char(w.UP_DATE, 'yyyy-mm-dd') = to_char(f.UP_DATE, 'yyyy-mm-dd')\n" +
            "         left join TF_YWPN_COSTRLPRICE_W p\n" +
            "                   on to_char(f.UP_DATE, 'yyyy') = p.YEAR\n" +
            "where f.MARK = 0\n" +
            "  and p.ISNEW = 1\n" +
            "  and to_char(f.UP_DATE, 'yyyy-mm') = #{year}\n" +
            "order by f.UP_DATE")
    List<Map<String, Object>> viewSumInfo(@Param("year") String year);
}
