Browse Source

update 财务添加订单

周箭河 4 years ago
parent
commit
09e781f920

+ 18 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/SellOrderDao.java

@@ -77,8 +77,26 @@ public interface SellOrderDao extends BaseDAO<Integer, SellOrder> {
 
     /**
      * 根据订单号删除
+     *
      * @param orderId
      * @return
      */
     int deleteByOrderId(@Param("orderId") Long orderId);
+
+    /**
+     * 获取乐团订单总收入
+     *
+     * @param startTime
+     * @param endTime
+     * @return
+     */
+    List<OperatingReport> getMusicGroupIncome(@Param("startTime") Date startTime, @Param("endTime") Date endTime);
+
+    /**
+     * 外部订单总收入
+     * @param startTime
+     * @param endTime
+     * @return
+     */
+    List<OperatingReport> getOutOrderIncome(@Param("startTime") Date startTime, @Param("endTime") Date endTime);
 }

+ 74 - 154
mec-biz/src/main/java/com/ym/mec/biz/service/impl/OperatingReportServiceImpl.java

@@ -100,176 +100,95 @@ public class OperatingReportServiceImpl extends BaseServiceImpl<Integer, Operati
             }
         }
 
-        //3.1、乐团订单的统计
-        List<OperatingReport> musicReports = sellOrderDao.getMusicGroupMonthReport(startTime, endTime);
-        for (OperatingReport musicReport : musicReports) {
-            OperatingReport organOperatingReport = new OperatingReport();
-            if (organOperating.containsKey(musicReport.getOrganId())) {
-                organOperatingReport = organOperating.get(musicReport.getOrganId());
-            }
-
-            OperatingReport cooperationOperatingReport = new OperatingReport();
-            if (cooperationOperating.containsKey(musicReport.getCooperationOrganId())) {
-                cooperationOperatingReport = cooperationOperating.get(musicReport.getCooperationOrganId());
-            }
-            organOperatingReport.setOrganId(musicReport.getOrganId());
-            cooperationOperatingReport.setOrganId(musicReport.getOrganId());
-            cooperationOperatingReport.setCooperationOrganId(musicReport.getCooperationOrganId());
-
-            if (musicReport.getSellAmount() == null) {
-                musicReport.setSellAmount(BigDecimal.ZERO);
-                musicReport.setSellCost(BigDecimal.ZERO);
-            }
-            BigDecimal serviceAmount = musicReport.getIncomeTotal().subtract(musicReport.getSellAmount());
-
-            organOperatingReport.setServiceAmount(organOperatingReport.getServiceAmount().add(serviceAmount));
-            organOperatingReport.setSellAmount(organOperatingReport.getSellAmount().add(musicReport.getSellAmount()));
-            organOperatingReport.setSellCost(organOperatingReport.getSellCost().add(musicReport.getSellCost()));
-            cooperationOperatingReport.setServiceAmount(cooperationOperatingReport.getServiceAmount().add(serviceAmount));
-            cooperationOperatingReport.setSellAmount(cooperationOperatingReport.getSellAmount().add(musicReport.getSellAmount()));
-            cooperationOperatingReport.setSellCost(cooperationOperatingReport.getSellCost().add(musicReport.getSellCost()));
-            organOperating.put(musicReport.getOrganId(), organOperatingReport);
-            cooperationOperating.put(musicReport.getCooperationOrganId(), cooperationOperatingReport);
-        }
-
+        //3.1、乐团销售订单的统计
+        List<OperatingReport> reports = sellOrderDao.getMusicGroupMonthReport(startTime, endTime);
+        //乐团订单总收入的统计
+        reports.addAll(sellOrderDao.getMusicGroupIncome(startTime, endTime));
         //3.2、VIP、网管课订单的统计(关联学生注册取一条记录)
-        List<OperatingReport> VPReports = sellOrderDao.getMusicVipPracticeMonthReport(startTime, endTime);
-        for (OperatingReport vpReport : VPReports) {
-            OperatingReport organOperatingReport = new OperatingReport();
-            if (organOperating.containsKey(vpReport.getOrganId())) {
-                organOperatingReport = organOperating.get(vpReport.getOrganId());
-            }
-
-            OperatingReport cooperationOperatingReport = new OperatingReport();
-            if (vpReport.getCooperationOrganId() != null && cooperationOperating.containsKey(vpReport.getCooperationOrganId())) {
-                cooperationOperatingReport = cooperationOperating.get(vpReport.getCooperationOrganId());
-            }
-            organOperatingReport.setOrganId(vpReport.getOrganId());
-            cooperationOperatingReport.setOrganId(vpReport.getOrganId());
-            cooperationOperatingReport.setCooperationOrganId(vpReport.getCooperationOrganId());
-
-            organOperatingReport.setServiceAmount(organOperatingReport.getServiceAmount().add(vpReport.getIncomeTotal()));
-            cooperationOperatingReport.setServiceAmount(cooperationOperatingReport.getServiceAmount().add(vpReport.getIncomeTotal()));
-
-
-            organOperating.put(vpReport.getOrganId(), organOperatingReport);
-
-            if (vpReport.getCooperationOrganId() != null) {
-                cooperationOperating.put(vpReport.getCooperationOrganId(), cooperationOperatingReport);
-            }
-        }
-
-        //3.3、外部添加订单
-        List<OperatingReport> outOrderReports = sellOrderDao.getOutOrderMonthReport(startTime, endTime);
-        for (OperatingReport outOrderReport : outOrderReports) {
-            OperatingReport organOperatingReport = new OperatingReport();
-            if (organOperating.containsKey(outOrderReport.getOrganId())) {
-                organOperatingReport = organOperating.get(outOrderReport.getOrganId());
-            }
-
-            OperatingReport cooperationOperatingReport = new OperatingReport();
-            if (cooperationOperating.containsKey(outOrderReport.getCooperationOrganId())) {
-                cooperationOperatingReport = cooperationOperating.get(outOrderReport.getCooperationOrganId());
-            }
-
-            organOperatingReport.setOrganId(outOrderReport.getOrganId());
-            cooperationOperatingReport.setOrganId(outOrderReport.getOrganId());
-            cooperationOperatingReport.setCooperationOrganId(outOrderReport.getCooperationOrganId());
-
-            if (outOrderReport.getSellAmount() == null) {
-                outOrderReport.setSellAmount(BigDecimal.ZERO);
-                outOrderReport.setSellCost(BigDecimal.ZERO);
-            }
-            BigDecimal serviceAmount = outOrderReport.getIncomeTotal().subtract(outOrderReport.getSellAmount());
-
-            organOperatingReport.setServiceAmount(organOperatingReport.getServiceAmount().add(serviceAmount));
-            organOperatingReport.setSellAmount(organOperatingReport.getSellAmount().add(outOrderReport.getSellAmount()));
-            organOperatingReport.setSellCost(organOperatingReport.getSellCost().add(outOrderReport.getSellCost()));
-            cooperationOperatingReport.setServiceAmount(cooperationOperatingReport.getServiceAmount().add(serviceAmount));
-            cooperationOperatingReport.setSellAmount(cooperationOperatingReport.getSellAmount().add(outOrderReport.getSellAmount()));
-            cooperationOperatingReport.setSellCost(cooperationOperatingReport.getSellCost().add(outOrderReport.getSellCost()));
-            organOperating.put(cooperationOperatingReport.getOrganId(), organOperatingReport);
-            if (outOrderReport.getCooperationOrganId() != null) {
-                cooperationOperating.put(cooperationOperatingReport.getCooperationOrganId(), cooperationOperatingReport);
-            }
-        }
-
+        reports.addAll(sellOrderDao.getMusicVipPracticeMonthReport(startTime, endTime));
+        //3.3、外部添加订单销售
+        reports.addAll(sellOrderDao.getOutOrderMonthReport(startTime, endTime));
+        //外部添加订单销售总收入
+        reports.addAll(sellOrderDao.getOutOrderIncome(startTime, endTime));
         //3.4、乐器维修、商品销售
-        List<OperatingReport> repairGoodsSellReports = sellOrderDao.getRepairGoodsSellGroupMonthReport(startTime, endTime);
-        for (OperatingReport repairGoodsSellReport : repairGoodsSellReports) {
-            OperatingReport organOperatingReport = new OperatingReport();
-            if (organOperating.containsKey(repairGoodsSellReport.getOrganId())) {
-                organOperatingReport = organOperating.get(repairGoodsSellReport.getOrganId());
-            }
-
-            organOperatingReport.setOrganId(repairGoodsSellReport.getOrganId());
-
-            if (repairGoodsSellReport.getSellAmount() == null) {
-                repairGoodsSellReport.setSellAmount(BigDecimal.ZERO);
-                repairGoodsSellReport.setSellCost(BigDecimal.ZERO);
-            }
-            BigDecimal serviceAmount = repairGoodsSellReport.getIncomeTotal().subtract(repairGoodsSellReport.getSellAmount());
-
-            organOperatingReport.setServiceAmount(organOperatingReport.getServiceAmount().add(serviceAmount));
-            organOperatingReport.setSellAmount(organOperatingReport.getSellAmount().add(repairGoodsSellReport.getSellAmount()));
-            organOperatingReport.setSellCost(organOperatingReport.getSellCost().add(repairGoodsSellReport.getSellCost()));
-
-            organOperating.put(repairGoodsSellReport.getOrganId(), organOperatingReport);
-        }
-
+        reports.addAll(sellOrderDao.getRepairGoodsSellGroupMonthReport(startTime, endTime));
         //3.5、零星支付充值
-        List<OperatingReport> rechargeReports = sellOrderDao.getRechargeMonthReport(startTime, endTime);
-        for (OperatingReport rechargeReport : rechargeReports) {
+        reports.addAll(sellOrderDao.getRechargeMonthReport(startTime, endTime));
+        //3.6、零星收费(不是充值部分的)
+        reports.addAll(sellOrderDao.getSporadicMonthReport(startTime, endTime));
+        updateFee(organOperating,cooperationOperating,reports);
+
+//        Map<String, Object> params = new HashMap<>();
+//        params.put("startTime", startTime);
+//        params.put("endTime", endTime);
+//        organOperating.forEach((organId, operatingReport) -> {
+//            operatingReport.setMonth(startTime);
+//            operatingReport.setCreateTime(nowDate);
+//            updateReport(operatingReport, params);
+//        });
+//        cooperationOperating.forEach((organId, operatingReport) -> {
+//            operatingReport.setMonth(startTime);
+//            operatingReport.setCreateTime(nowDate);
+//            updateReport(operatingReport, params);
+//        });
+        return true;
+    }
+
+    /**
+     * 计算总收入
+     *
+     * @param organOperating
+     * @param cooperationOperating
+     * @param reports
+     */
+    private void updateFee(Map<Integer, OperatingReport> organOperating, Map<Integer, OperatingReport> cooperationOperating, List<OperatingReport> reports) {
+        for (OperatingReport report : reports) {
             OperatingReport organOperatingReport = new OperatingReport();
-            if (organOperating.containsKey(rechargeReport.getOrganId())) {
-                organOperatingReport = organOperating.get(rechargeReport.getOrganId());
+            if (organOperating.containsKey(report.getOrganId())) {
+                organOperatingReport = organOperating.get(report.getOrganId());
             }
 
             OperatingReport cooperationOperatingReport = new OperatingReport();
-            if (rechargeReport.getCooperationOrganId() != null && cooperationOperating.containsKey(rechargeReport.getCooperationOrganId())) {
-                cooperationOperatingReport = cooperationOperating.get(rechargeReport.getCooperationOrganId());
+            if (report.getCooperationOrganId() != null && cooperationOperating.containsKey(report.getCooperationOrganId())) {
+                cooperationOperatingReport = cooperationOperating.get(report.getCooperationOrganId());
             }
-            organOperatingReport.setOrganId(rechargeReport.getOrganId());
-            cooperationOperatingReport.setOrganId(rechargeReport.getOrganId());
-            cooperationOperatingReport.setCooperationOrganId(rechargeReport.getCooperationOrganId());
-
-            organOperatingReport.setOtherIncome(organOperatingReport.getOtherIncome().add(rechargeReport.getIncomeTotal()));
-            cooperationOperatingReport.setOtherIncome(cooperationOperatingReport.getIncomeTotal().add(rechargeReport.getIncomeTotal()));
-
-            organOperating.put(rechargeReport.getOrganId(), organOperatingReport);
+            organOperatingReport.setOrganId(report.getOrganId());
+            cooperationOperatingReport.setOrganId(report.getOrganId());
+            cooperationOperatingReport.setCooperationOrganId(report.getCooperationOrganId());
 
-            if (rechargeReport.getCooperationOrganId() != null) {
-                cooperationOperating.put(rechargeReport.getCooperationOrganId(), cooperationOperatingReport);
+            if (report.getSellAmount() == null) {
+                report.setSellAmount(BigDecimal.ZERO);
+                report.setSellCost(BigDecimal.ZERO);
             }
-        }
-
-        //3.6、零星收费(不是充值部分的)
-        List<OperatingReport> sporadicReports = sellOrderDao.getSporadicMonthReport(startTime, endTime);
-        for (OperatingReport sporadicReport : sporadicReports) {
-            OperatingReport organOperatingReport = new OperatingReport();
-            if (organOperating.containsKey(sporadicReport.getOrganId())) {
-                organOperatingReport = organOperating.get(sporadicReport.getOrganId());
+            if (report.getIncomeTotal() == null) {
+                report.setIncomeTotal(BigDecimal.ZERO);
             }
-
-            OperatingReport cooperationOperatingReport = new OperatingReport();
-            if (sporadicReport.getCooperationOrganId() != null && cooperationOperating.containsKey(sporadicReport.getCooperationOrganId())) {
-                cooperationOperatingReport = cooperationOperating.get(sporadicReport.getCooperationOrganId());
+            if (report.getOtherIncome() == null) {
+                report.setOtherIncome(BigDecimal.ZERO);
             }
-            organOperatingReport.setOrganId(sporadicReport.getOrganId());
-            cooperationOperatingReport.setOrganId(sporadicReport.getOrganId());
-            cooperationOperatingReport.setCooperationOrganId(sporadicReport.getCooperationOrganId());
 
-            organOperatingReport.setServiceAmount(organOperatingReport.getServiceAmount().add(sporadicReport.getIncomeTotal()));
-            cooperationOperatingReport.setServiceAmount(cooperationOperatingReport.getServiceAmount().add(sporadicReport.getIncomeTotal()));
+            //总收入
+            organOperatingReport.setIncomeTotal(organOperatingReport.getIncomeTotal().add(report.getIncomeTotal()));
+            cooperationOperatingReport.setIncomeTotal(cooperationOperatingReport.getIncomeTotal().add(report.getIncomeTotal()));
 
+            //销售收入
+            organOperatingReport.setSellAmount(organOperatingReport.getSellAmount().add(report.getSellAmount()));
+            organOperatingReport.setSellCost(organOperatingReport.getSellCost().add(report.getSellCost()));
+            cooperationOperatingReport.setSellAmount(cooperationOperatingReport.getSellAmount().add(report.getSellAmount()));
+            cooperationOperatingReport.setSellCost(cooperationOperatingReport.getSellCost().add(report.getSellCost()));
 
-            organOperating.put(sporadicReport.getOrganId(), organOperatingReport);
+            //其他收入
+            organOperatingReport.setOtherIncome(organOperatingReport.getOtherIncome().add(report.getOtherIncome()));
+            cooperationOperatingReport.setOtherIncome(cooperationOperatingReport.getOtherIncome().add(report.getOtherIncome()));
 
-            if (sporadicReport.getCooperationOrganId() != null) {
-                cooperationOperating.put(sporadicReport.getCooperationOrganId(), cooperationOperatingReport);
+            organOperating.put(report.getOrganId(), organOperatingReport);
+            if (report.getCooperationOrganId() != null) {
+                cooperationOperating.put(report.getCooperationOrganId(), cooperationOperatingReport);
             }
         }
-
+        Date nowDate = new Date();
+        Date startTime = DateUtil.getFirstDayOfMonth(DateUtil.addDays1(nowDate, -1));
+        Date endTime = DateUtil.getLastDayOfMonth(startTime);
         Map<String, Object> params = new HashMap<>();
         params.put("startTime", startTime);
         params.put("endTime", endTime);
@@ -283,12 +202,13 @@ public class OperatingReportServiceImpl extends BaseServiceImpl<Integer, Operati
             operatingReport.setCreateTime(nowDate);
             updateReport(operatingReport, params);
         });
-        return true;
     }
 
     private void updateReport(OperatingReport operatingReport, Map<String, Object> params) {
         //收入合计:销售收入+服务收入-业务退费
-        BigDecimal incomeTotal = operatingReport.getSellAmount().add(operatingReport.getServiceAmount()).add(operatingReport.getOtherIncome()).subtract(operatingReport.getRefundAmount());
+        BigDecimal serviceTotal = operatingReport.getIncomeTotal().subtract(operatingReport.getSellAmount()).subtract(operatingReport.getOtherIncome());
+        operatingReport.setServiceAmount(serviceTotal);
+        BigDecimal incomeTotal = operatingReport.getIncomeTotal().subtract(operatingReport.getRefundAmount());
         operatingReport.setIncomeTotal(incomeTotal);
         //成本费用合计:销售成本+固定支出+变动支出+分摊费用
         BigDecimal costAmount = operatingReport.getSellCost().add(operatingReport.getExpensesAmount()).add(operatingReport.getVariableCost()).add(operatingReport.getDistributionAmount());

+ 1 - 1
mec-biz/src/main/resources/config/mybatis/OperatingReportMapper.xml

@@ -141,7 +141,7 @@
         </where>
     </sql>
     <select id="getReport" resultMap="OperatingReport" parameterType="map">
-        SELECT * FROM operating_report opr
+        SELECT * FROM operating_report
         <where>
             <if test="organId != null">
                 AND organ_id_ = #{organId}

+ 52 - 18
mec-biz/src/main/resources/config/mybatis/SellOrderMapper.xml

@@ -52,7 +52,8 @@
     <insert id="insert" keyColumn="id_" keyProperty="id" parameterType="com.ym.mec.biz.dal.entity.SellOrder"
             useGeneratedKeys="true">
         <!--@mbg.generated-->
-        insert into sell_order (organ_id_, cooperation_organ_id_, trans_no_,order_id_, order_no_, expect_amount_, actual_amount_,
+        insert into sell_order (organ_id_, cooperation_organ_id_, trans_no_,order_id_, order_no_, expect_amount_,
+        actual_amount_,
         balance_amount_, type_, goods_id_,goods_name_, sell_cost_, sell_cost2_, num_, user_id_, payment_channel_,
         mer_no_, sell_time_, create_ime_, update_time_)
         values (#{organId}, #{cooperationOrganId}, #{transNo}, #{orderNo},#{orderId}, #{expectAmount}, #{actualAmount},
@@ -129,7 +130,8 @@
     </update>
 
     <insert id="batchInsert" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id_">
-        insert into sell_order (organ_id_, cooperation_organ_id_, trans_no_,order_id_, order_no_, expect_amount_, actual_amount_,
+        insert into sell_order (organ_id_, cooperation_organ_id_, trans_no_,order_id_, order_no_, expect_amount_,
+        actual_amount_,
         balance_amount_, type_, goods_id_,goods_name_, sell_cost_, sell_cost2_, num_, user_id_, payment_channel_,
         mer_no_, sell_time_, create_ime_, update_time_)
         VALUE
@@ -188,10 +190,9 @@
     <!-- 获取分部学校的收入支出(乐团订单) -->
     <select id="getMusicGroupMonthReport" resultMap="com.ym.mec.biz.dal.dao.OperatingReportDao.OperatingReport"><![CDATA[
         SELECT spo.organ_id_,
-               co.id_                  cooperation_organ_id_,
-               SUM(spo.actual_amount_) income_total_,
-               SUM(so.actual_amount_)  sell_amount_,
-               SUM(so.sell_cost_)      sellCost
+               co.id_                 cooperation_organ_id_,
+               SUM(so.actual_amount_) sell_amount_,
+               SUM(so.sell_cost_)     sellCost
         FROM student_payment_order spo
                  LEFT JOIN sell_order so on so.order_id_ = spo.id_
                  LEFT JOIN music_group mg ON mg.id_ = spo.music_group_id_
@@ -203,6 +204,20 @@
         GROUP BY spo.organ_id_, co.id_
         ]]></select>
 
+    <select id="getMusicGroupIncome" resultMap="com.ym.mec.biz.dal.dao.OperatingReportDao.OperatingReport"><![CDATA[
+        SELECT spo.organ_id_,
+               co.id_                  cooperation_organ_id_,
+               SUM(spo.actual_amount_) income_total_
+        FROM student_payment_order spo
+                 LEFT JOIN music_group mg ON mg.id_ = spo.music_group_id_
+                 LEFT JOIN cooperation_organ co ON co.id_ = mg.cooperation_organ_id_
+        WHERE spo.status_ = 'SUCCESS'
+          AND spo.group_type_ = 'MUSIC'
+          AND spo.create_time_ >= #{startTime}
+          AND spo.create_time_ <= #{endTime}
+        GROUP BY spo.organ_id_, co.id_
+        ]]></select>
+
     <!-- 获取分部学校的收入支出(VIP,网管课) -->
     <select id="getMusicVipPracticeMonthReport" resultMap="com.ym.mec.biz.dal.dao.OperatingReportDao.OperatingReport"><![CDATA[
         SELECT spo.organ_id_,
@@ -228,10 +243,9 @@
     <!-- 获取分部学校的收入支出(外部添加订单) -->
     <select id="getOutOrderMonthReport" resultMap="com.ym.mec.biz.dal.dao.OperatingReportDao.OperatingReport"><![CDATA[
         SELECT spo.organ_id_,
-               co.id_                  cooperation_organ_id_,
-               SUM(spo.actual_amount_) income_total_,
-               SUM(so.actual_amount_)  sell_amount_,
-               SUM(so.sell_cost_)      sellCost
+               co.id_                 cooperation_organ_id_,
+               SUM(so.actual_amount_) sell_amount_,
+               SUM(so.sell_cost_)     sellCost
         FROM student_payment_order spo
                  LEFT JOIN sell_order so on so.order_id_ = spo.id_
                  LEFT JOIN cooperation_organ co ON co.id_ = spo.music_group_id_
@@ -242,11 +256,26 @@
         GROUP BY spo.organ_id_, co.id_
         ]]></select>
 
+    <!-- 获取分部学校的收入支出(外部添加订单) -->
+    <select id="getOutOrderIncome" resultMap="com.ym.mec.biz.dal.dao.OperatingReportDao.OperatingReport"><![CDATA[
+        SELECT spo.organ_id_,
+               co.id_                  cooperation_organ_id_,
+               SUM(spo.actual_amount_) income_total_
+        FROM student_payment_order spo
+                 LEFT JOIN cooperation_organ co ON co.id_ = spo.music_group_id_
+        WHERE spo.status_ = 'SUCCESS'
+          AND spo.group_type_ = 'OUTORDER'
+          AND spo.create_time_ >= #{startTime}
+          AND spo.create_time_ <= #{endTime}
+        GROUP BY spo.organ_id_, co.id_
+        ]]></select>
+
     <!-- 获取分部学校的收入(充值) -->
     <select id="getRechargeMonthReport" resultMap="com.ym.mec.biz.dal.dao.OperatingReportDao.OperatingReport"><![CDATA[
         SELECT spo.organ_id_,
                co.id_                  cooperation_organ_id_,
-               SUM(spo.actual_amount_) income_total_
+               SUM(spo.actual_amount_) income_total_,
+               SUM(spo.actual_amount_) other_income_
         FROM student_payment_order spo
                  LEFT JOIN sporadic_charge_info sci ON sci.id_ = spo.music_group_id_
                  LEFT JOIN music_group mg ON mg.id_ = sci.music_group_id_
@@ -277,15 +306,16 @@
         ]]></select>
 
     <!-- 获取分部学校的收入支出(维修、商品销售订单) -->
-    <select id="getRepairGoodsSellGroupMonthReport" resultMap="com.ym.mec.biz.dal.dao.OperatingReportDao.OperatingReport"><![CDATA[
+    <select id="getRepairGoodsSellGroupMonthReport"
+            resultMap="com.ym.mec.biz.dal.dao.OperatingReportDao.OperatingReport"><![CDATA[
         SELECT spo.organ_id_,
-               SUM(spo.actual_amount_) income_total_,
-               SUM(so.actual_amount_)  sell_amount_,
-               SUM(so.sell_cost_)      sellCost
+               SUM(so.actual_amount_) income_total_,
+               SUM(so.actual_amount_) sell_amount_,
+               SUM(so.sell_cost_)     sellCost
         FROM student_payment_order spo
                  LEFT JOIN sell_order so on so.order_id_ = spo.id_
         WHERE spo.status_ = 'SUCCESS'
-          AND spo.group_type_ IN ('REPAIR','GOODS_SELL')
+          AND spo.group_type_ IN ('REPAIR', 'GOODS_SELL')
           AND spo.create_time_ >= #{startTime}
           AND spo.create_time_ <= #{endTime}
         GROUP BY spo.organ_id_
@@ -293,10 +323,14 @@
 
     <!-- 获取订单的销售列表 -->
     <select id="getOrderSellOrder" resultMap="SellOrder">
-        SELECT * FROM sell_order WHERE order_id_ = #{orderId}
+        SELECT *
+        FROM sell_order
+        WHERE order_id_ = #{orderId}
     </select>
 
     <delete id="deleteByOrderId">
-        DELETE FROM sell_order WHERE order_id_=#{orderId}
+        DELETE
+        FROM sell_order
+        WHERE order_id_ = #{orderId}
     </delete>
 </mapper>